Browse files

Fix an issue with pc-fbsdupdatecheck and the Updater GUI

  • Loading branch information...
1 parent 04630fb commit d47ba2506f80291b75693885ed70c932c8deb3cc @kmoore134 kmoore134 committed Sep 5, 2013
Showing with 21 additions and 8 deletions.
  1. +2 −2 src-qt4/pc-updategui/mainWin.cpp
  2. +19 −6 src-sh/pc-fbsdupdatecheck/main.c
View
4 src-qt4/pc-updategui/mainWin.cpp
@@ -552,11 +552,11 @@ void mainWin::checkFBSDUpdates() {
// Now check if there are freebsd-updates to install
QProcess f;
if ( wDir.isEmpty() )
- f.start(QString("pc-fbsdupdatecheck"), QStringList());
+ f.start(QString("pc-fbsdupdatecheck"), QStringList() << "update" );
else {
QProcess::execute("cp /usr/local/bin/pc-fbsdupdatecheck " + wDir + "/tmp/.fbupdatechk");
QProcess::execute("chmod 755 " + wDir + "/tmp/.fbupdatechk");
- f.start(QString("chroot"), QStringList() << wDir << "/tmp/.fbupdatechk" << "fetch" );
+ f.start(QString("chroot"), QStringList() << wDir << "/tmp/.fbupdatechk" << "update" );
}
while(f.state() == QProcess::Starting || f.state() == QProcess::Running)
QCoreApplication::processEvents();
View
25 src-sh/pc-fbsdupdatecheck/main.c
@@ -6,11 +6,24 @@
#include <string.h>
#include <unistd.h>
-int main()
+int main(int argc, char ** argv)
{
- system("touch /tmp/.fbsdup-lock");
- system("mkdir /var/db/freebsd-update-check 2>/dev/null");
- system("cat /usr/sbin/freebsd-update | sed 's|! -t 0|-z '1'|g' | /bin/sh -s 'fetch' '-d' '/var/db/freebsd-update-check'");
- system("rm /tmp/.fbsdup-lock");
- return 0;
+ if ( argc == 2 ) {
+ if ( strcmp(argv[1], "update") != 0 )
+ {
+ printf("Invalid option!");
+ return 1;
+ }
+ // Fetch to the standard working-dir
+ system("touch /tmp/.fbsdup-lock");
+ system("cat /usr/sbin/freebsd-update | sed 's|! -t 0|-z '1'|g' | /bin/sh -s 'fetch'");
+ system("rm /tmp/.fbsdup-lock");
+ return 0;
+ } else {
+ system("touch /tmp/.fbsdup-lock");
+ system("mkdir /var/db/freebsd-update-check 2>/dev/null");
+ system("cat /usr/sbin/freebsd-update | sed 's|! -t 0|-z '1'|g' | /bin/sh -s 'fetch' '-d' '/var/db/freebsd-update-check'");
+ system("rm /tmp/.fbsdup-lock");
+ return 0;
+ }
}

0 comments on commit d47ba25

Please sign in to comment.