[PC-BSD Commits] r20794 - users/ken/EasyPBI2

svn at pcbsd.org svn at pcbsd.org
Fri Dec 28 10:01:41 PST 2012


Author: kenmoore
Date: 2012-12-28 18:01:41 +0000 (Fri, 28 Dec 2012)
New Revision: 20794

Modified:
   users/ken/EasyPBI2/portsDialog.cpp
Log:
Yay! Finally got portsnap working properly from within EasyPBI2!



Modified: users/ken/EasyPBI2/portsDialog.cpp
===================================================================
--- users/ken/EasyPBI2/portsDialog.cpp	2012-12-28 17:59:55 UTC (rev 20793)
+++ users/ken/EasyPBI2/portsDialog.cpp	2012-12-28 18:01:41 UTC (rev 20794)
@@ -107,19 +107,33 @@
   ui->progressBar->setMaximum(0); ui->progressBar->setMinimum(0); //default to a "loading" indicator
   ui->label_status->setText(tr("Requesting Root Access"));
   QString cmd = suCMD + " \""; //use the swutch-user utility
-  QString portsnapNonInteractive = "cat /usr/sbin/portsnap | sed 's|! -t 0|-z '1'|g' | /bin/sh -s";
+  bool usePortsnap = FALSE;
   if(systemPorts){
     //Update the ports tree	  
     if( QFile::exists("/usr/ports/.svn") ){
       cmd.append("svn update /usr/ports");
     }else{
-      cmd.append(portsnapNonInteractive + " fetch update");
+      cmd.append("portsnap fetch update");
+      usePortsnap = TRUE;
     }
   }else{
     //Fresh installation of the ports tree
-    cmd.append(portsnapNonInteractive + " fetch extract");
+    cmd.append("portsnap fetch extract");
+    usePortsnap = TRUE;
   }
   cmd.append("\""); //close the quotes
+  //If using portsnap, make sure the intermediate file is there in the EasyPBI directory
+  if( usePortsnap ){
+    QString pspath = localPortsTree;
+    pspath.chop( pspath.length() - pspath.lastIndexOf("/") );
+    pspath.append(".portsnapNI.sh");
+    if( !QFile::exists(pspath) ){
+      QString pscmd ="echo \"#!/bin/sh \ncat /usr/sbin/portsnap | sed 's|! -t 0|-z '1'|g' | /bin/sh -s \\$@\" > "+pspath+"; chmod 755 "+pspath;
+      qDebug() << "system call:" << pscmd;
+      system(pscmd.toUtf8());
+    }
+    cmd.replace("portsnap",pspath);
+  }
   //Now run the command
   p->start(cmd);
   qDebug() << "System ports update started: CMD:" << cmd;



More information about the Commits mailing list