X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=blobdiff_plain;f=chroot-script;h=f221d500aa4eccae6760becbd62936057b5ece56;hp=f9e3b0e8acd8d5f697fcd58f29c93de8b0c417f0;hb=df0f07e25b7de55740c79376b65cf962ffb3833f;hpb=9661ed19d8209b2505f4224f6613c81cfbc18629 diff --git a/chroot-script b/chroot-script index f9e3b0e..f221d50 100755 --- a/chroot-script +++ b/chroot-script @@ -17,7 +17,7 @@ set -e # exit on any error # use aptitude only if it's available if [ -x /usr/bin/aptitude ] ; then - APTINSTALL='aptitude -y install ' + APTINSTALL='aptitude -y --without-recommends install ' APTUPDATE='aptitude update' else APTINSTALL='apt-get --force-yes -y install' @@ -131,6 +131,11 @@ EOF # install additional packages {{{ packages() { + # Pre-seed the debconf database with answers. Each question will be marked + # as seen to prevent debconf from asking the question interactively. + [ -f /etc/debootstrap/debconf-selections ] && \ + cat /etc/debootstrap/debconf-selections | debconf-set-selections + if [ "$PACKAGES" = 'yes' ] ; then if ! [ -r /etc/debootstrap/packages ] ; then echo "Error: /etc/debootstrap/packages not found, exiting." @@ -200,13 +205,14 @@ reconfigure() { # }}} # set password of user root {{{ -passwords() { +passwords() +{ echo "Activating shadow passwords." shadowconfig on if [ -n "$ROOTPASSWORD" ] ; then - echo root:"$ROOTPASSWD" | chpasswd -m - export ROOTPASSWD='' + echo root:"$ROOTPASSWORD" | chpasswd -m + export ROOTPASSWORD='' else a='1' b='2' @@ -218,12 +224,15 @@ passwords() { echo -n "Retype new UNIX password for user root: " read -s b echo - echo root:"$a" | chpasswd -m if [ "$a" != "$b" ] ; then echo "Sorry, passwords do not match. Retry." + a='1' + b='2' + else + echo root:"$a" | chpasswd -m + unset a + unset b fi - unset a - unset b done fi } @@ -269,8 +278,13 @@ timezone() { # helper function for fstab() {{{ createfstab(){ echo "Setting up /etc/fstab" -cat > /etc/fstab << EOF -$TARGET / auto defaults,errors=remount-ro 0 1 +if [ -n "$TARGET_UUID" ] ; then + echo "/dev/disk/by-uuid/${TARGET_UUID} / auto defaults,errors=remount-ro 0 1" > /etc/fstab +else + echo "${TARGET} / auto defaults,errors=remount-ro 0 1" > /etc/fstab +fi + +cat >> /etc/fstab << EOF proc /proc proc defaults 0 0 /sys /sys sysfs noauto,rw,nosuid,nodev,noexec 0 0 /dev/cdrom /mnt/cdrom0 iso9660 ro,user,noauto 0 0 @@ -354,7 +368,11 @@ grub() { $UPDATEGRUB -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 ${BOOT_APPEND}|g" /boot/grub/menu.lst + if [ -n "$TARGET_UUID" ] ; then + sed -i "s|^# kopt=root=.*|# kopt=root=UUID=${TARGET_UUID} ro ${BOOT_APPEND}|g" /boot/grub/menu.lst + else + sed -i "s|^# kopt=root=.*|# kopt=root=${TARGET} ro ${BOOT_APPEND}|g" /boot/grub/menu.lst + fi # not sure why savedefault does not work for me; any ideas? sed -i "s/^savedefault.*/# &/g" /boot/grub/menu.lst $UPDATEGRUB -y