From d965b4983de8c08698d60c3d23c446d0acba0e5e Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Mon, 16 Apr 2007 12:21:36 +0200 Subject: [PATCH] Use aptitude instead of apt-get in chroot-script --- chroot-script | 31 +++++++++++++++++++++---------- debian/changelog | 4 ++++ grml-debootstrap | 2 +- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/chroot-script b/chroot-script index 81fc132..cdb6c0a 100644 --- a/chroot-script +++ b/chroot-script @@ -4,7 +4,7 @@ # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2. -# Latest change: Don Apr 12 11:55:23 CEST 2007 [mika] +# Latest change: Mon Apr 16 12:21:19 CEST 2007 [mika] ################################################################################ set -e # exit on any error @@ -14,6 +14,15 @@ set -e # exit on any error [ -r /proc/1 ] || mount -t proc none /proc +# use aptitude only if it's available +if [ -x /usr/bin/aptitude ] ; then + APTINSTALL='aptitude -y' + APTUPDATE='aptitude update' +else + APTINSTALL='apt-get --force-yes -y' + APTUPDATE='apt-get update' +fi + # variable checks {{{ if [ -z "$STAGES" ] ; then STAGES='/etc/debootstrap/stages' @@ -79,8 +88,8 @@ packages() { echo "Error: /etc/debootstrap/packages not found, exiting." exit 1 else - apt-get update - apt-get --force-yes -y install $(cat /etc/debootstrap/packages) $GRMLPACKAGES + $APTUPDATE + $APT $(cat /etc/debootstrap/packages) $GRMLPACKAGES fi fi } @@ -106,13 +115,13 @@ kernel() { fi if [ -n "$KERNEL" ] ; then - apt-get update + $APTUPDATE if [ "$RELEASE" = 'sarge' ] ; then KERNELPACKAGES="kernel-image-$KERNEL kernel-headers-$KERNEL" else KERNELPACKAGES="linux-image-$KERNEL linux-headers-$KERNEL" fi - apt-get --force-yes -y install $KERNELPACKAGES + $APTINSTALL $KERNELPACKAGES fi } # }}} @@ -252,11 +261,13 @@ grub() { # finally install grub update-grub -y - sed -i "s/^# groot=.*/# groot=(${GROOT})/g" /boot/grub/menu.lst - sed -i "s|^# kopt=root=.*|# kopt=root=${TARGET} ro|g" /boot/grub/menu.lst - # not sure why savedefault does not work for me; any ideas? - sed -i "s/^savedefault.*/# &/g" /boot/grub/menu.lst - update-grub -y + if [ -f /boot/grub/menu.lst ] ; then + sed -i "s/^# groot=.*/# groot=(${GROOT})/g" /boot/grub/menu.lst + sed -i "s|^# kopt=root=.*|# kopt=root=${TARGET} ro|g" /boot/grub/menu.lst + # not sure why savedefault does not work for me; any ideas? + sed -i "s/^savedefault.*/# &/g" /boot/grub/menu.lst + update-grub -y + fi fi } # }}} diff --git a/debian/changelog b/debian/changelog index 54aa752..398f3c5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,9 @@ grml-debootstrap (0.7) unstable; urgency=low + * Use aptitude instead of apt-get in chroot-script, but + only if it's available. + * Added additional check to grub code for running sed on + /boot/grub/menu.lst. * Updated TODO file. -- Michael Prokop Fri, 13 Apr 2007 17:57:29 +0200 diff --git a/grml-debootstrap b/grml-debootstrap index 72098fb..6ba7842 100644 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -10,7 +10,7 @@ set -e # exit on any error -VERSION='0.6' +VERSION='0.8' # source core functions {{{ . /etc/grml/lsb-functions -- 2.1.4