X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=blobdiff_plain;f=grml-debootstrap;h=feb7aa1e78293fef1b0cbad43c7fd98a5208686c;hp=df8af46cc3a444b1323621e6e061a57731b1e9c0;hb=ad7c3cfdaa7c6354c951a9dbbad6ada40a1dc082;hpb=aadfa9e6736484c002413f02de93057b9a814449 diff --git a/grml-debootstrap b/grml-debootstrap index df8af46..feb7aa1 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -73,6 +73,7 @@ Configuration options: --debconf Pre-seed packages using specified pre-seed db file. --keep_src_list Do not overwrite user provided apt sources.list. --hostname Hostname of Debian system. + --nopassword Do not prompt for the root password. --password Use specified password as password for user root. --bootappend Add specified appendline to kernel whilst booting. --chroot-scripts Execute chroot scripts from specified directory. @@ -270,6 +271,7 @@ fi [ "$_opt_keep_src_list" ] && KEEP_SRC_LIST='yes' [ "$_opt_hostname" ] && HOSTNAME=$_opt_hostname [ "$_opt_password" ] && ROOTPASSWORD=$_opt_password +[ "$_opt_nopassword" ] && NOPASSWORD='yes' [ "$_opt_bootappend" ] && BOOT_APPEND=$_opt_bootappend [ "$_opt_grub" ] && GRUB=$_opt_grub [ "$_opt_arch" ] && ARCH=$_opt_arch @@ -465,23 +467,28 @@ 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) - [ $? -eq 0 ] || bailout - ROOTPW2=$(dialog --insecure --stdout --title "${PN}" --passwordbox \ - "Please enter the password for the root account again for \ - confirmation:" 10 60) - [ $? -eq 0 ] || bailout - - if [ "$ROOTPW1" != "$ROOTPW2" ]; then - $(dialog --stdout --title "${PN}" --ok-label \ - "Retry" --msgbox "Passwords do not match!" 10 60) - fi - done - ROOTPASSWORD="$ROOTPW1" + if [ "$_opt_nopassword" ] ; then + einfo "Skip asking for root password as requested." + return 0 + fi + + 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) + [ $? -eq 0 ] || bailout + ROOTPW2=$(dialog --insecure --stdout --title "${PN}" --passwordbox \ + "Please enter the password for the root account again for \ + confirmation:" 10 60) + [ $? -eq 0 ] || bailout + + if [ "$ROOTPW1" != "$ROOTPW2" ]; then + $(dialog --stdout --title "${PN}" --ok-label \ + "Retry" --msgbox "Passwords do not match!" 10 60) + fi + done + ROOTPASSWORD="$ROOTPW1" } # }}} @@ -1002,6 +1009,7 @@ preparechroot() { [ -n "$PACKAGES" ] && echo "PACKAGES=$PACKAGES" >> $CHROOT_VARIABLES [ -n "$RM_APTCACHE" ] && echo "RM_APTCACHE=$RM_APTCACHE" >> $CHROOT_VARIABLES [ -n "$ROOTPASSWORD" ] && echo "ROOTPASSWORD=$ROOTPASSWORD" >> $CHROOT_VARIABLES + [ -n "$NOPASSWORD" ] && echo "NOPASSWORD=true" >> $CHROOT_VARIABLES [ -n "$SELECTED_PARTITIONS" ] && echo "SELECTED_PARTITIONS=$SELECTED_PARTITIONS" >> $CHROOT_VARIABLES [ -n "$TARGET" ] && echo "TARGET=$TARGET" >> $CHROOT_VARIABLES [ -n "$TARGET_UUID" ] && echo "TARGET_UUID=$TARGET_UUID" >> $CHROOT_VARIABLES