[PC-BSD Commits] r1708 - pcbsd/trunk/kcmPBMsource
svn at pcbsd.org
svn at pcbsd.org
Thu Apr 10 14:18:38 PDT 2008
Author: kris
Date: 2008-04-10 14:18:37 -0700 (Thu, 10 Apr 2008)
New Revision: 1708
Modified:
pcbsd/trunk/kcmPBMsource/pbm.ui
pcbsd/trunk/kcmPBMsource/pbm.ui.h
Log:
Fixed a slew of bugs in the PBI removal tool, now removal scripts will run
even if a space is in the program name, also fixed bugs with the /Programs/<progDir> not being deleted, since the processes we're getting clobbered too quickly.
Also fixed a bug where the programs directory will not be rm -rf'd until
after the PBI.RemoveScript.sh is finished up
Modified: pcbsd/trunk/kcmPBMsource/pbm.ui
===================================================================
--- pcbsd/trunk/kcmPBMsource/pbm.ui 2008-04-10 17:48:23 UTC (rev 1707)
+++ pcbsd/trunk/kcmPBMsource/pbm.ui 2008-04-10 21:18:37 UTC (rev 1708)
@@ -337,6 +337,11 @@
<variable access="private">QProcess *CheckRoot;</variable>
<variable access="private">QString RealUserName;</variable>
<variable access="private">QProcess *RemoveFile;</variable>
+ <variable access="private">QProcess *RemoveFile1;</variable>
+ <variable access="private">QProcess *RemoveFile2;</variable>
+ <variable access="private">QProcess *RemoveFile3;</variable>
+ <variable access="private">QProcess *RemoveFile4;</variable>
+ <variable access="private">QProcess *RemoveFile5;</variable>
<variable access="private">KDirWatch *fileWatcher;</variable>
</variables>
<slots>
Modified: pcbsd/trunk/kcmPBMsource/pbm.ui.h
===================================================================
--- pcbsd/trunk/kcmPBMsource/pbm.ui.h 2008-04-10 17:48:23 UTC (rev 1707)
+++ pcbsd/trunk/kcmPBMsource/pbm.ui.h 2008-04-10 21:18:37 UTC (rev 1708)
@@ -255,10 +255,10 @@
RemoveFile->start();
// Remove the application file
- RemoveFile = new QProcess( this );
- RemoveFile->addArgument( "rm" );
- RemoveFile->addArgument( "/usr/local/share/mimelnk/application/" + *mime + ".desktop" );
- RemoveFile->start();
+ RemoveFile1 = new QProcess( this );
+ RemoveFile1->addArgument( "rm" );
+ RemoveFile1->addArgument( "/usr/local/share/mimelnk/application/" + *mime + ".desktop" );
+ RemoveFile1->start();
}
// Remove the scripts
@@ -276,39 +276,40 @@
}
// Remove the script
- RemoveFile = new QProcess( this );
- RemoveFile->addArgument( "rm" );
- RemoveFile->addArgument( "/Programs/.sbin/" + Binary );
- RemoveFile->start();
+ RemoveFile2 = new QProcess( this );
+ RemoveFile2->addArgument( "rm" );
+ RemoveFile2->addArgument( "/Programs/.sbin/" + Binary );
+ RemoveFile2->start();
// Remove the Desktop item
- RemoveFile = new QProcess( this );
- RemoveFile->addArgument( "/Programs/.bin/RemoveDesktopLink.sh" );
- RemoveFile->addArgument( Binary + ".desktop" );
- RemoveFile->addArgument( pbi->getName() );
- RemoveFile->start();
+ RemoveFile3 = new QProcess( this );
+ RemoveFile3->addArgument( "/Programs/.bin/RemoveDesktopLink.sh" );
+ RemoveFile3->addArgument( Binary + ".desktop" );
+ RemoveFile3->addArgument( pbi->getName() );
+ RemoveFile3->start();
}
// Remove the start menu item
- RemoveFile = new QProcess( this );
- RemoveFile->addArgument( "rm" );
- RemoveFile->addArgument( "-r" );
- RemoveFile->addArgument( "/usr/local/share/applnk/My Programs/" + pbi->getName() );
- RemoveFile->start();
+ RemoveFile4 = new QProcess( this );
+ RemoveFile4->addArgument( "rm" );
+ RemoveFile4->addArgument( "-r" );
+ RemoveFile4->addArgument( "/usr/local/share/applnk/My Programs/" + pbi->getName() );
+ RemoveFile4->start();
// Remove the start menu item
- RemoveFile = new QProcess( this );
- RemoveFile->addArgument( "rm" );
- RemoveFile->addArgument( "-rf" );
- RemoveFile->addArgument( "/usr/local/share/applnk/" + pbi->getName());
- RemoveFile->start();
-
+ RemoveFile5 = new QProcess( this );
+ RemoveFile5->addArgument( "rm" );
+ RemoveFile5->addArgument( "-rf" );
+ RemoveFile5->addArgument( "/usr/local/share/applnk/" + pbi->getName());
+ RemoveFile5->start();
+
+ // Done via the CheckScript function now
// Remove the program folder
- RemoveFile = new QProcess( this );
- RemoveFile->addArgument( "rm" );
- RemoveFile->addArgument( "-r" );
- RemoveFile->addArgument( "/Programs/" + ProgDirName );
- RemoveFile->start();
+ // RemoveFile5 = new QProcess( this );
+ // RemoveFile5->addArgument( "rm" );
+ // RemoveFile5->addArgument( "-r" );
+ // RemoveFile5->addArgument( "/Programs/" + ProgDirName );
+ // RemoveFile5->start();
}
@@ -327,12 +328,28 @@
void PBM::CheckScriptSlot(PBI *pbi)
{
- QString progDir = pbi->getName() + pbi->getVersion();
-
- // Check if a custom removal script exists, and run it
- QFile CheckScript("/Programs/" + progDir + "/PBI.RemoveScript.sh");
- if (CheckScript.exists())
- {
+// Function has been modified by KPM 04-10-08
+// Now it always writes out a wrapper script, which then checks
+// for PBI.RemoveScript.sh, and runs it, or just rm -rf progDir
+
+ QString progDir, tmp;
+
+ // Set our ProgDirName variable
+ tmp = pbi->getName();
+ tmp.replace(" ", "");
+ progDir = tmp;
+ tmp = pbi->getVersion();
+ tmp.replace(" ", "");
+ progDir = progDir + tmp;
+
+ qDebug("ProgDir: " + progDir);
+
+ if ( progDir.isEmpty() )
+ {
+ KMessageBox::error(this, tr("progDir EMPTY! Please contact PC-BSD developers!"));
+ return;
+ }
+
// Write out the wrapper script
QFile file( "/Programs/" + progDir + "/.PBIwrapper.sh" );
if ( file.open( IO_WriteOnly ) )
@@ -342,7 +359,12 @@
stream << "PROGDIR=\"" + progDir + "\"; export PROGDIR\n";
stream << "USERNAME=\"" + RealUserName + "\"; export USERNAME\n";
stream << "INSTALLMODE=\"GUI\"; export INSTALLMODE\n";
- stream << "sh /Programs/" + progDir + "/PBI.RemoveScript.sh ${PROGDIR}\nexit ${?}";
+ stream << "if [ -e \"/Programs/" + progDir + "/PBI.RemoveScript.sh\" ]\n";
+ stream << "then\n";
+ stream << " sh /Programs/" + progDir + "/PBI.RemoveScript.sh ${PROGDIR}\n";
+ stream << "fi\n";
+ stream << "rm -rf /Programs/" + progDir + "\n";
+ stream << "exit 0\n";
file.close();
}
@@ -350,7 +372,6 @@
RemoveScript->addArgument( "sh" );
RemoveScript->addArgument( "/Programs/" + progDir + "/.PBIwrapper.sh" );
if ( !RemoveScript->start() ) KMessageBox::error(this, tr("Error starting custom removal script!"));
- }
}
More information about the Commits
mailing list