X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fupstream%2Fbackupninja.git;a=blobdiff_plain;f=handlers%2Fsys.in;h=f293840157b323004092ffac8db97309a272ddb7;hp=2c48883ce11576639a7ae7231249b59ccd840c6f;hb=947b6f03ff22074b667ffec8067e5295dd13874b;hpb=33ff4f7506fcaab09fd7ad898507f37b7777ba8f diff --git a/handlers/sys.in b/handlers/sys.in index 2c48883..f293840 100755 --- a/handlers/sys.in +++ b/handlers/sys.in @@ -53,8 +53,8 @@ then getconf packagesfile $parentdir/dpkg-selections.txt getconf packagemgr `which dpkg` getconf packagemgroptions ' --get-selections *' - getconf selectionsfile $parentir/debconfsel.txt - getconf debconfgetselections `debconf-get-selections` + getconf selectionsfile $parentdir/debconfsel.txt + getconf debconfgetselections `which debconf-get-selections` elif [ $os = "redhat" ] then getconf packagesfile $parentdir/rpmpackages.txt @@ -116,7 +116,7 @@ if [ "$packages" == "yes" ]; then continue fi # is $packagemgr available inside $vserver ? - if [ ! -x "$VROOTDIR/$vserver`$VSERVER $vserver exec which $packagemgr`" ]; then + if [ ! -x "${VROOTDIR}/${vserver}${packagemgr}" ]; then warning "can't find $packagemgr in vserver $vserver, skipping installed packages report." else # don't expand * since it can be used in $packagemgroptions @@ -126,12 +126,21 @@ if [ "$packages" == "yes" ]; then set +o noglob fi # is $debconfgetselections available inside $vserver ? - if [ ! -x "$VROOTDIR/$vserver`$VSERVER $vserver exec which $debconfgetselections`" ]; then - warning "can't find $debconfgetselections in vserver $vserver, skipping package selection states." + found=no + # case #1: it is available on the host, is it available inside $vserver ? + if [ -n "$debconfgetselections" ]; then + [ -x "${VROOTDIR}/${vserver}${debconfgetselections}" ] && found=yes + # case #2: it is not available on the host, is it available inside $vserver ? + else + [ -n "`$VSERVER $vserver exec which debconf-get-selections`" ] && found=yes + fi + if [ "$found" != yes ]; then + warning "can't find debconf-get-selections in vserver $vserver, skipping package selection states. You may want to install the debconf-utils package." else debug "$VSERVER $vserver exec $debconfgetselections > $VROOTDIR/$vserver$selectionsfile" - $VSERVER $vserver exec $debconfgetselections > $VROOTDIR/$vserver$selectionsfile || fatal "can not save $debconfgetselections info to $selectionsfile" + $VSERVER $vserver exec $debconfgetselections > $VROOTDIR/$vserver$selectionsfile || fatal "can not save debconf-get-selections info to $selectionsfile" fi + unset found done fi @@ -146,7 +155,7 @@ if [ "$packages" == "yes" ]; then set +o noglob fi if [ -z "$debconfgetselections" ]; then - warning "can't find ${debconfgetselections}, skilling package selection states." + warning "can't find debconf-get-selections, skipping package selection states. You might want to install the debconf-utils package." else debug "$debconfgetselections > $selectionsfile" $debconfgetselections > $selectionsfile || fatal "can not save $debconfgetselections info to $selectionsfile" @@ -188,10 +197,12 @@ catiffile () { } catifexec () { - echo $HASHES >> $sysreportfile - echo "# $STATUS" >> $sysreportfile - echo $HASHES >> $sysreportfile - $1 >> $sysreportfile 2>&1 || info "executing of $1 failed" + if [ -x $1 ]; then + echo $HASHES >> $sysreportfile + echo "# $STATUS" >> $sysreportfile + echo $HASHES >> $sysreportfile + $* >> $sysreportfile 2>&1 || info "executing of $1 failed" + fi } @@ -215,7 +226,7 @@ catifexec "/bin/df" "-al" STATUS="Collecting what services run at what run level:" if [ $os = "redhat" ]; then - catifexec "/sbin/chkconfig --list" + catifexec "/sbin/chkconfig" "--list" STATUS="Collecting information about /etc/rc.d:" catiffile "/bin/ls /etc/rc.d/rc*.d/" @@ -234,7 +245,7 @@ elif [ $os = "debian" ]; then fi STATUS="Getting bootloader information:" -catifexec "/bin/ls -alR /boot" +catifexec "/bin/ls" "-alR /boot" # This covers sparc, alpha, and intel (respectively) # updated for grub -mpg @@ -249,7 +260,7 @@ fi if [ -f /etc/lilo.conf ]; then STATUS="Collecting information about the boot process (lilo):" catiffile "/etc/lilo.conf" - catifexec "/sbin/lilo -q" + catifexec "/sbin/lilo" "-q" fi if [ -d /boot/grub -a -f /boot/grub/grub.conf -a -f /boot/grub/device.map ]; then STATUS="Collecting information about the boot process (grub.conf):" @@ -275,13 +286,13 @@ STATUS="Gathering sysctl information (/etc/sysctl.conf):" catiffile "/etc/sysctl.conf" STATUS="Gathering IP information (/sbin/ifconfig):" -catifexec "/sbin/ifconfig -a" +catifexec "/sbin/ifconfig" "-a" STATUS="Gathering additional IP information (/bin/ip addr list):" -catifexec "/bin/ip addr list" +catifexec "/bin/ip" "addr list" STATUS="Checking network routes:" -catifexec "/sbin/route -n" +catifexec "/sbin/route" "-n" STATUS="Collecting Name Service Switch config information:" catiffile "/etc/nsswitch.conf" @@ -300,7 +311,7 @@ catifexec "/sbin/lsmod" for x in $(/sbin/lsmod | /bin/cut -f1 -d" " 2>/dev/null | /bin/grep -v Module 2>/dev/null ) ; do STATUS="Checking module information $x:" - catifexec "/sbin/modinfo $x" + catifexec "/sbin/modinfo" "$x" done STATUS="Gathering information about your filesystems:" @@ -380,7 +391,7 @@ STATUS="Gathering information about your ide drivers:" catiffile "/proc/ide" STATUS="Gathering information about your bus:" -catifexec lspci +catifexec "/usr/bin/lspci" catiffile "/proc/bus" echo @@ -391,7 +402,7 @@ STATUS="Collecting information from /etc/fstab:" catiffile "/etc/fstab" STATUS="Collecting disk partition information:" -catifexec "fdisk -l" +catifexec "/sbin/fdisk" "-l" STATUS="Checking mounted file systems (mount) " catifexec "/bin/mount" @@ -408,6 +419,9 @@ catiffile "/etc/raidtab" STATUS="Collecting Software RAID information (/etc/mdadm.conf)" catiffile "/etc/mdadm.conf" +STATUS="Collecting Software RAID information (/sbin/mdadm -Q)" +catifexec "/sbin/mdadm" "-Q" "--detail" '/dev/md?*' + STATUS="Collecting Automount information (auto.master)" catiffile "/etc/auto.master"