Skip to content
Snippets Groups Projects
Commit 33ff4f75 authored by micah's avatar micah :speech_balloon:
Browse files

add the ability to save the debconf package selection states in the sys...

add the ability to save the debconf package selection states in the sys handler, which aides in restoring installed packages with the right choices made
parent ca12e561
No related branches found
No related tags found
No related merge requests found
...@@ -45,6 +45,8 @@ version 0.9.6 -- unreleased ...@@ -45,6 +45,8 @@ version 0.9.6 -- unreleased
(Closes: Trac#39) (Closes: Trac#39)
. support selection of VServers to run on, in the same way as in the . support selection of VServers to run on, in the same way as in the
dup handler, with the new vsnames configuration option ; (Closes: Trac#45) dup handler, with the new vsnames configuration option ; (Closes: Trac#45)
. add support for capturing the package debconf selection states using
debconf-get-selections
version 0.9.5 -- December 2, 2007 version 0.9.5 -- December 2, 2007
backupninja changes backupninja changes
......
...@@ -2,20 +2,27 @@ ...@@ -2,20 +2,27 @@
# this config file will save various reports of vital system information. # this config file will save various reports of vital system information.
# by default, all the reports are enabled and are saved in /var/backups. # by default, all the reports are enabled and are saved in /var/backups.
# #
# requires dpkg, sfdisk, and hwinfo # requires dpkg, debconf-utils, sfdisk, and hwinfo
# #
# (1) a list of all the packages installed and removed. # (1) a capture of the debconf package selection states. This file
# can be used to restore the answers to debconf questions for
# packages that you will be installing through (2) below. To
# do this, run: "debconf-set-selections < debconfsel.txt"
#
# (2) a list of all the packages installed and removed.
# this file can be used to restore the state of installed packages # this file can be used to restore the state of installed packages
# by running "dpkg --set-selections < dpkg-selections.txt # by running "dpkg --set-selections < dpkg-selections.txt and
# then run "apt-get -u dselect-upgrade". If you have the
# debconf-set-selections file from (1), you should restore those first.
# #
# (2) the partition table of all disks. # (3) the partition table of all disks.
# this partition table can be used to format another disk of # this partition table can be used to format another disk of
# the same size. this can be handy if using software raid and # the same size. this can be handy if using software raid and
# you have a disk go bad. just replace the disk and partition it # you have a disk go bad. just replace the disk and partition it
# by running "sfdisk /dev/sdb < partitions.sdb.txt" # by running "sfdisk /dev/sdb < partitions.sdb.txt"
# (MAKE SURE YOU PARTITION THE CORRECT DISK!!!) # (MAKE SURE YOU PARTITION THE CORRECT DISK!!!)
# #
# (3) hardware information. # (4) hardware information.
# detailed information on most important aspects of the hardware. # detailed information on most important aspects of the hardware.
# #
...@@ -25,6 +32,7 @@ ...@@ -25,6 +32,7 @@
# parentdir = /var/backups # parentdir = /var/backups
# packages = yes # packages = yes
# packagesfile = /var/backups/dpkg-selections.txt # packagesfile = /var/backups/dpkg-selections.txt
# selectionsfile = /var/backups/debconfsel.txt
# partitions = yes # partitions = yes
# NOTE: the __star__ below will be replaced by the disks found on the # NOTE: the __star__ below will be replaced by the disks found on the
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
HELPERS="$HELPERS sys:general_hardware_and_system_info" HELPERS="$HELPERS sys:general_hardware_and_system_info"
sys_wizard() { sys_wizard() {
require_packages hwinfo require_packages hwinfo debconf-utils
checkBox "new sys action" "check options" \ checkBox "new sys action" "check options" \
"packages" "list of all installed packages." on \ "packages" "list of all installed packages." on \
"partitions" "the partition table of all disks." on \ "partitions" "the partition table of all disks." on \
...@@ -30,6 +30,7 @@ $partitions ...@@ -30,6 +30,7 @@ $partitions
$sfdisk $sfdisk
$hardware $hardware
# packagesfile = /var/backups/dpkg-selections.txt # packagesfile = /var/backups/dpkg-selections.txt
# selectionsfile = /var/backups/debconfsel.txt
# partitionsfile = /var/backups/partitions.__star__.txt # partitionsfile = /var/backups/partitions.__star__.txt
# hardwarefile = /var/backups/hardware.txt # hardwarefile = /var/backups/hardware.txt
......
...@@ -3,18 +3,25 @@ ...@@ -3,18 +3,25 @@
# this handler will save various reports of vital system information. # this handler will save various reports of vital system information.
# by default, all the reports are enabled and are saved in /var/backups. # by default, all the reports are enabled and are saved in /var/backups.
# #
# (1) a list of all the packages installed and removed. # (1) a capture of the debconf package selection states. This file
# can be used to restore the answers to debconf questions for
# packages that you will be installing through (2) below. To
# do this, run: "debconf-set-selections < debconfsel.txt"
#
# (2) a list of all the packages installed and removed.
# this file can be used to restore the state of installed packages # this file can be used to restore the state of installed packages
# by running "dpkg --set-selections < dpkg-selections.txt # by running "dpkg --set-selections < dpkg-selections.txt and
# then run "apt-get -u dselect-upgrade". If you have the
# debconf-set-selections file from (1), you should restore those first.
# #
# (2) the partition table of all disks. # (3) the partition table of all disks.
# this partition table can be used to format another disk of # this partition table can be used to format another disk of
# the same size. this can be handy if using software raid and # the same size. this can be handy if using software raid and
# you have a disk go bad. just replace the disk and partition it # you have a disk go bad. just replace the disk and partition it
# by running "sfdisk /dev/sdb < partitions.sdb.txt" # by running "sfdisk /dev/sdb < partitions.sdb.txt"
# (MAKE SURE YOU PARTITION THE CORRECT DISK!!!) # (MAKE SURE YOU PARTITION THE CORRECT DISK!!!)
# #
# (3) hardware information. # (4) hardware information.
# write to a text file the important things which hwinfo can gleen. # write to a text file the important things which hwinfo can gleen.
# #
...@@ -46,6 +53,8 @@ then ...@@ -46,6 +53,8 @@ then
getconf packagesfile $parentdir/dpkg-selections.txt getconf packagesfile $parentdir/dpkg-selections.txt
getconf packagemgr `which dpkg` getconf packagemgr `which dpkg`
getconf packagemgroptions ' --get-selections *' getconf packagemgroptions ' --get-selections *'
getconf selectionsfile $parentir/debconfsel.txt
getconf debconfgetselections `debconf-get-selections`
elif [ $os = "redhat" ] elif [ $os = "redhat" ]
then then
getconf packagesfile $parentdir/rpmpackages.txt getconf packagesfile $parentdir/rpmpackages.txt
...@@ -109,13 +118,20 @@ if [ "$packages" == "yes" ]; then ...@@ -109,13 +118,20 @@ if [ "$packages" == "yes" ]; then
# is $packagemgr available inside $vserver ? # is $packagemgr available inside $vserver ?
if [ ! -x "$VROOTDIR/$vserver`$VSERVER $vserver exec which $packagemgr`" ]; then if [ ! -x "$VROOTDIR/$vserver`$VSERVER $vserver exec which $packagemgr`" ]; then
warning "can't find $packagemgr in vserver $vserver, skipping installed packages report." warning "can't find $packagemgr in vserver $vserver, skipping installed packages report."
continue else
fi
# don't expand * since it can be used in $packagemgroptions # don't expand * since it can be used in $packagemgroptions
set -o noglob set -o noglob
debug "$VSERVER $vserver exec $packagemgr $packagemgroptions > $VROOTDIR/$vserver$packagesfile" debug "$VSERVER $vserver exec $packagemgr $packagemgroptions > $VROOTDIR/$vserver$packagesfile"
$VSERVER $vserver exec $packagemgr $packagemgroptions > $VROOTDIR/$vserver$packagesfile || fatal "can not save $packagemgr info to $packagesfile" $VSERVER $vserver exec $packagemgr $packagemgroptions > $VROOTDIR/$vserver$packagesfile || fatal "can not save $packagemgr info to $packagesfile"
set +o noglob 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."
else
debug "$VSERVER $vserver exec $debconfgetselections > $VROOTDIR/$vserver$selectionsfile"
$VSERVER $vserver exec $debconfgetselections > $VROOTDIR/$vserver$selectionsfile || fatal "can not save $debconfgetselections info to $selectionsfile"
fi
done done
fi fi
...@@ -129,7 +145,12 @@ if [ "$packages" == "yes" ]; then ...@@ -129,7 +145,12 @@ if [ "$packages" == "yes" ]; then
$packagemgr $packagemgroptions > $packagesfile || fatal "can not save $packagemgr info to $packagesfile" $packagemgr $packagemgroptions > $packagesfile || fatal "can not save $packagemgr info to $packagesfile"
set +o noglob set +o noglob
fi fi
if [ -z "$debconfgetselections" ]; then
warning "can't find ${debconfgetselections}, skilling package selection states."
else
debug "$debconfgetselections > $selectionsfile"
$debconfgetselections > $selectionsfile || fatal "can not save $debconfgetselections info to $selectionsfile"
fi
fi fi
## System report ############################## ## System report ##############################
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment