mysql,pgsql,svn,sys: fixed failing "is vserver running" test
[matthijs/upstream/backupninja.git] / handlers / sys
index 83af9b9d8db6eb1e82e750298d1c50e1591a826d..66f1595f12e8e932f414b45986cf830d730beb09 100755 (executable)
@@ -52,7 +52,7 @@ if [ "$packages" == "yes" ]; then
                do
                        info "examining vserver: $vserver"
                        running=`$VSERVERINFO $vserver RUNNING`
-                       if [ $running = 1 ]; then
+                       if [ "$running" = "1" ]; then
                            if [ ! -x "$VROOTDIR/$vserver`$VSERVER $vserver exec which dpkg`" ]; then
                                warning "can't find dpkg in vserver $vserver, skipping installed packages report."
                                nodpkg="$nodpkg|$vserver"
@@ -95,22 +95,23 @@ fi
 # here we grab a list of the packages installed and removed.
 #
 
-if [ $usevserver ]
-then
-       for vserver in `ls $VROOTDIR | grep -E -v $nodpkg`
-       do
-               debug "$VSERVER $vserver exec dpkg --get-selections > $VROOTDIR/$vserver$packagesfile"
-               $VSERVER $vserver exec dpkg --get-selections > $VROOTDIR/$vserver$packagesfile
-       done
-fi
-
-# We want to perform this on the host as well
 if [ "$packages" == "yes" ]; then
-       debug "dpkg --get-selections > $packagesfile"
-       dpkg --get-selections > $packagesfile
+   if [ $usevserver ]
+   then
+      for vserver in `ls $VROOTDIR | grep -E -v $nodpkg`
+      do
+        debug "$VSERVER $vserver exec dpkg --get-selections > $VROOTDIR/$vserver$packagesfile"
+        $VSERVER $vserver exec dpkg --get-selections > $VROOTDIR/$vserver$packagesfile
+      done
+   fi
+   
+# We want to perform this on the host as well
+   if [ "$packages" == "yes" ]; then
+      debug "dpkg --get-selections > $packagesfile"
+      dpkg --get-selections > $packagesfile
+   fi
 fi
 
-
 ## PARTITIONS #############################
 
 # here we use sfdisk to dump a listing of all the partitions.