r261@crapouille: intrigeri | 2005-12-28 20:59:01 +0100
[matthijs/upstream/backupninja.git] / handlers / sys
index cb0856bd2b02a5eee728714247f1cd7544be835c..94f76cf369c9016c555c3c52544607dc4551dad5 100755 (executable)
@@ -1,3 +1,4 @@
+# -*- mode: sh; sh-basic-offset: 8; indent-tabs-mode: nil; -*-
 #
 # this handler will save various reports of vital system information.
 # by default, all the reports are enabled and are saved in /var/backups.
@@ -46,20 +47,20 @@ fi
 if [ "$packages" == "yes" ]; then
        if [ $usevserver ]
        then
-               nodpkg="lost+found"
+               nodpkg="lost+found|ARCHIVES"
                info "vserver root directory set to: $VROOTDIR"
-               for vserver in `ls $VROOTDIR |grep -v $nodpkg`
+               for vserver in `ls $VROOTDIR | grep -E -v $nodpkg`
                do
                        info "examining vserver: $vserver"
-                       running=`vserver-info $vserver RUNNING`
-                       if [ $running = 1 ]; then
-                           if [ ! -x "`$VSERVER $vserver exec which dpkg`" ]; then
+                       running=`$VSERVERINFO $vserver RUNNING`
+                       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"
+                               nodpkg="$nodpkg|$vserver"
                            fi
                        else
                            warning "vserver $vserver is not running, skipping installed packages report."
-                           nodpkg="$nodpkg $vserver"
+                           nodpkg="$nodpkg|$vserver"
                        fi
 
                done
@@ -95,22 +96,23 @@ fi
 # here we grab a list of the packages installed and removed.
 #
 
-if [ $usevserver ]
-then
-       for vserver in `ls $VROOTDIR | grep -v $nodpkg | grep -v lost+found`
-       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.