changeset 1261:8bfbfd4ea568

Merge
author Andre Heinecke <andre.heinecke@intevation.de>
date Fri, 26 Sep 2014 15:25:59 +0200
parents 82792b3a16bd (diff) 8ceaa189570d (current diff)
children dcce1e7201e2
files ui/mainwindow.cpp
diffstat 2 files changed, 48 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/packaging/linux-installer.inc	Fri Sep 26 11:31:12 2014 +0200
+++ b/packaging/linux-installer.inc	Fri Sep 26 15:25:59 2014 +0200
@@ -73,7 +73,7 @@
 parse_args()
 {
   OPTS=`getopt \
-      -l uninstall,update,show-after-update,force,help,prefix:,system,version \
+      -l uninstall,update,force,help,prefix:,system,version \
       -o d,f,p:,s -n "$ME" -- "$@"`
   [ $? -eq 0 ] || usage 23
 
@@ -155,6 +155,10 @@
       # $lock_dir is generate by the shar
       temp_dirs+=("${instcfg[PREFIX]}/$lock_dir")
   fi
+  if [ "${TMPEXTRACT_DIR:-}" ]; then
+      temp_dirs+=("$TMPEXTRACT_DIR")
+  fi
+
   if [ "${lock_dir:-}" ]; then
       temp_dirs+=("$extra_bin_path")
   fi
@@ -324,7 +328,15 @@
 
 getxt "unpacking files ...\n"
 OLDWD="$PWD"
-cd "${instcfg[PREFIX]}"
+
+if [ $UPDATE -eq 1 ]; then
+    # Trustbridge might be running. Install into temporary dir
+    # and move the directory into the installation prefix afterwards
+    TMPEXTRACT_DIR=$(mktemp -d)
+    cd "$TMPEXTRACT_DIR"
+else
+    cd "${instcfg[PREFIX]}"
+fi
 
 set +u
 set -- '-c'
@@ -333,6 +345,11 @@
 ###SHAR###
 # ----------------------------------------------------------------------
 
+if [ $UPDATE -eq 1 ]; then
+    cp -fr "$TMPEXTRACT_DIR/bin" "${instcfg[PREFIX]}"
+    cp -fr "$TMPEXTRACT_DIR/share" "${instcfg[PREFIX]}"
+fi
+
 cd "$OLDWD"
 
 getxt "Preparing trustbridge-tray-starter ...\n"
--- a/ui/mainwindow.cpp	Fri Sep 26 11:31:12 2014 +0200
+++ b/ui/mainwindow.cpp	Fri Sep 26 15:25:59 2014 +0200
@@ -438,6 +438,11 @@
         sudoParams << parameters;
         updaterProcess->setArguments(sudoParams);
 
+#if 0
+        updaterProcess->setStandardErrorFile("/tmp/tb-inst-err.log");
+        updaterProcess->setStandardOutputFile("/tmp/tb-inst-out.log");
+#endif
+
         foreach (const QString &sProg, sudoPrograms) {
             qDebug() << "Starting process " << sProg <<" params: " << sudoParams;
             updaterProcess->setProgram(sProg);
@@ -511,31 +516,6 @@
     }
     QDateTime listInstalledLastMod = mSettings.value("List/installedDate").toDateTime();
     QDateTime swInstalledLastMod = mSettings.value("Software/installedDate").toDateTime();
-
-    QDateTime swAvailableLastMod = mSettings.value("Software/availableDate").toDateTime();
-
-    if (swAvailableLastMod.isValid() && swInstalledLastMod.isValid()) {
-        if (swInstalledLastMod >= swAvailableLastMod) {
-            qDebug() << "Installed an update: " << swInstalledLastMod <<
-                " available " << swAvailableLastMod;
-            syslog_info_printf ("Software has been updated to version: %s\n",
-                QApplication::applicationVersion().toUtf8().constData());
-            QString fileName = mSettings.value("Software/available").toString();
-            if (fileName.isEmpty()) {
-                qDebug() << "Software marked as available but no filename set.";
-            } else {
-                if (QFile::remove(fileName)) {
-                    qDebug() << "Removed: " << fileName;
-                } else {
-                    qDebug() << "Failed to remove: " << fileName;
-                }
-            }
-            /* Clear out available data. */
-            mSettings.remove("Software/available");
-            mSettings.remove("Software/availableDate");
-        }
-    }
-
     QString listResource = QString::fromLatin1(LIST_RESOURCE);
     QString swResource = QString::fromLatin1(SW_RESOURCE);
 
@@ -608,6 +588,30 @@
 
 void MainWindow::setLastModifiedSWDate(const QDateTime &date)
 {
+    QDateTime swAvailableLastMod = mSettings.value("Software/availableDate").toDateTime();
+
+    if (swAvailableLastMod.isValid() && date.isValid()) {
+        if (date >= swAvailableLastMod) {
+            qDebug() << "Installed an update: " << date <<
+                " available was " << swAvailableLastMod;
+            syslog_info_printf ("Software has been updated to version: %s\n",
+                QApplication::applicationVersion().toUtf8().constData());
+            QString fileName = mSettings.value("Software/available").toString();
+            if (fileName.isEmpty()) {
+                qDebug() << "Software marked as available but no filename set.";
+            } else {
+                if (QFile::remove(fileName)) {
+                    qDebug() << "Removed: " << fileName;
+                } else {
+                    qDebug() << "Failed to remove: " << fileName;
+                }
+            }
+            /* Clear out available data. */
+            mSettings.remove("Software/available");
+            mSettings.remove("Software/availableDate");
+        }
+    }
+
     mSettings.beginGroup("Software");
 #ifdef IS_TAG_BUILD
     /* We accept an invalid date to force installing any avialable update

http://wald.intevation.org/projects/trustbridge/