X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=handlers%2Fsys;h=349f284817048dd29c23f59195964393b0240d72;hb=bb0dd6974edc81c52faab471b2c685245b7fdb68;hp=83af9b9d8db6eb1e82e750298d1c50e1591a826d;hpb=4e0c31d01627b9c01ff09841e1061f42750997f6;p=matthijs%2Fupstream%2Fbackupninja.git diff --git a/handlers/sys b/handlers/sys index 83af9b9..349f284 100755 --- a/handlers/sys +++ b/handlers/sys @@ -1,3 +1,4 @@ +# -*- mode: sh; sh-basic-offset: 3; 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. @@ -32,27 +33,23 @@ getconf sfdisk_options "" getconf hwinfo_options "" # See if vservers are configured -if [ "$vservers" = "yes" ] +local usevserver=no +if [ $vservers_are_available = yes ] then - if [ ! -d $VROOTDIR ] - then - fatal "vservers enabled, but $VROOTDIR does not exist!" - else - info "vserver method enabled" - usevserver=1 - fi + info "vserver method enabled" + usevserver=yes fi if [ "$packages" == "yes" ]; then - if [ $usevserver ] + if [ $usevserver = yes ] then nodpkg="lost+found|ARCHIVES" info "vserver root directory set to: $VROOTDIR" - for vserver in `ls $VROOTDIR | grep -E -v $nodpkg` + for vserver in $found_vservers 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 +92,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 = yes ] + 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.