From: Michael Prokop Date: Tue, 2 Sep 2008 11:37:39 +0000 (+0200) Subject: Use root=UUID=... by default, provide interface for root passwd, fix hostname problem X-Git-Tag: 0.20~1 X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=commitdiff_plain;h=eb41d15245c7313fc75c05bf5f3b56697c8c57e0 Use root=UUID=... by default, provide interface for root passwd, fix hostname problem --- diff --git a/chroot-script b/chroot-script index 0c7c3c8..5b68a0b 100755 --- a/chroot-script +++ b/chroot-script @@ -206,8 +206,8 @@ 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' @@ -273,8 +273,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 @@ -358,7 +363,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 diff --git a/debian/changelog b/debian/changelog index 3dbfae5..f6c7fde 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,8 +2,12 @@ grml-debootstrap (0.19) unstable; urgency=low * Use dialog with --separate-output option to make sure mdadm receives correct quoting for the RAID devices. + * Use root=UUID=... by default if possible to avoid possible + race conditions with libata vs. pata. + * Fix setting hostname via interface. + * Provide interface in dialog for setting root password. - -- Michael Prokop Mon, 01 Sep 2008 12:16:55 +0200 + -- Michael Prokop Tue, 02 Sep 2008 13:36:12 +0200 grml-debootstrap (0.18) unstable; urgency=low diff --git a/grml-debootstrap b/grml-debootstrap index b97e298..7a0bdaa 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -255,6 +255,27 @@ prompt_for_hostname() } # }}} +# ask for password {{{ +prompt_for_password() +{ + ROOTPW1='PW1' + ROOTPW2='PW2' + while [ "$ROOTPW1" != "$ROOTPW2" ]; do + ROOTPW1=$(dialog --insecure --stdout --title "${PN}" --passwordbox \ + "Please enter the password for the root account:" 10 60) + ROOTPW2=$(dialog --insecure --stdout --title "${PN}" --passwordbox \ + "Please enter the password for the root account again for \ + confirmation:" 10 60) + + if [ "$ROOTPW1" != "$ROOTPW2" ]; then + $(dialog --stdout --title "${PN}" --ok-label \ + "Retry" --msgbox "Passwords do not match!" 10 60) + fi + done + ROOTPASSWORD="$ROOTPW1" +} +# }}} + # ask for Debian mirror {{{ prompt_for_mirror() { @@ -452,6 +473,8 @@ interactive_mode() prompt_for_hostname + prompt_for_password + # use first disk of sw-raid for grub by default, install grub on # all involved disks later on if echo "$TARGET" | grep -q '/dev/md' ; then @@ -550,21 +573,6 @@ ISODIR=${ISO##file:} ISODIR=${ISODIR%%/} # }}} -# provide variables to chroot system {{{ -CHROOT_VARIABLES="/var/cache/grml-debootstrap/variables_${SHORT_TARGET}" -touch $CHROOT_VARIABLES -chmod 600 $CHROOT_VARIABLES # make sure nobody except root can read it -[ -n "$ARCH" ] && echo "ARCH=$ARCH" > $CHROOT_VARIABLES -[ -n "$GRUB" ] && echo "GRUB=$GRUB" >> $CHROOT_VARIABLES -[ -n "$GROOT" ] && echo "GROOT=$GROOT" >> $CHROOT_VARIABLES -[ -n "$TARGET" ] && echo "TARGET=$TARGET" >> $CHROOT_VARIABLES -[ -n "$ISO" ] && echo "ISO=$ISO" >> $CHROOT_VARIABLES -[ -n "$ISODIR" ] && echo "ISODIR=$ISO" >> $CHROOT_VARIABLES -[ -n "$MIRROR" ] && echo "MIRROR=$MIRROR" >> $CHROOT_VARIABLES -[ -n "$MIRROR" ] && echo "CHROOTMIRROR=$MIRROR" >> $CHROOT_VARIABLES -[ -n "$ROOTPASSWORD" ] && echo "ROOTPASSWORD=$ROOTPASSWORD" >> $CHROOT_VARIABLES -# }}} - # helper functions {{{ # we want to exit smoothly and clean: bailout(){ @@ -634,6 +642,7 @@ mkfs() { if [ -n "$MKFS" ] ; then einfo "Running $MKFS on $TARGET" $MKFS $TARGET + TARGET_UUID="$(vol_id -u $TARGET 2>/dev/null || echo '')" eend $? fi } @@ -692,6 +701,24 @@ debootstrap_system() { # prepare chroot via chroot-script {{{ preparechroot() { einfo "Preparing chroot system" + + # provide variables to chroot system + CHROOT_VARIABLES="/var/cache/grml-debootstrap/variables_${SHORT_TARGET}" + touch $CHROOT_VARIABLES + chmod 600 $CHROOT_VARIABLES # make sure nobody except root can read it + echo "# Configuration of ${PN}" > $CHROOT_VARIABLES + [ -n "$ARCH" ] && echo "ARCH=$ARCH" >> $CHROOT_VARIABLES + [ -n "$GROOT" ] && echo "GROOT=$GROOT" >> $CHROOT_VARIABLES + [ -n "$GRUB" ] && echo "GRUB=$GRUB" >> $CHROOT_VARIABLES + [ -n "$HOSTNAME" ] && echo "HOSTNAME=$HOSTNAME" >> $CHROOT_VARIABLES + [ -n "$ISODIR" ] && echo "ISODIR=$ISO" >> $CHROOT_VARIABLES + [ -n "$ISO" ] && echo "ISO=$ISO" >> $CHROOT_VARIABLES + [ -n "$MIRROR" ] && echo "CHROOTMIRROR=$MIRROR" >> $CHROOT_VARIABLES + [ -n "$MIRROR" ] && echo "MIRROR=$MIRROR" >> $CHROOT_VARIABLES + [ -n "$ROOTPASSWORD" ] && echo "ROOTPASSWORD=$ROOTPASSWORD" >> $CHROOT_VARIABLES + [ -n "$TARGET" ] && echo "TARGET=$TARGET" >> $CHROOT_VARIABLES + [ -n "$TARGET_UUID" ] && echo "TARGET_UUID=$TARGET_UUID" >> $CHROOT_VARIABLES + cp $CONFFILES/chroot-script $MNTPOINT/bin/chroot-script chmod 755 $MNTPOINT/bin/chroot-script mkdir $MNTPOINT/etc/debootstrap/