remove bashism "read -s" from chroot-script
authorChristian Hofstaedtler <ch@grml.org>
Mon, 18 Oct 2010 12:17:57 +0000 (14:17 +0200)
committerChristian Hofstaedtler <ch@zeha.at>
Mon, 18 Oct 2010 12:39:44 +0000 (14:39 +0200)
chroot-script runs in target, which might very well use dash, which
doesn't have "read -s". Patch based on mira's recommendations.

chroot-script
debian/changelog

index bbd834f..b5e60b4 100755 (executable)
@@ -42,6 +42,15 @@ stage() {
   echo "   Executing stage ${1}"
   return 0
 }
+
+askpass() {
+  # read -s emulation for dash. result is in $resp.
+  set -o noglob
+  stty -echo
+  read resp
+  stty echo
+  set +o noglob
+}
 # }}}
 
 # define chroot mirror {{{
@@ -227,10 +236,14 @@ passwords()
      echo "Setting password for user root:"
      while [ "$a" != "$b" ] ; do
        echo -n "Enter new UNIX password for user root: "
-       read -s a
+       askpass
+       a="$resp"
+       unset resp
        echo
        echo -n "Retype new UNIX password for user root: "
-       read -s b
+       askpass
+       b="$resp"
+       unset resp
        echo
        if [ "$a" != "$b" ] ; then
          echo "Sorry, passwords do not match. Retry."
index e00510a..2683195 100644 (file)
@@ -3,7 +3,10 @@ grml-debootstrap (0.39) UNRELEASED; urgency=low
   [ Tong Sun ]
   * remove 'umount -a' in bailout(). [Closes: issue806].
 
- -- Michael Prokop <mika@grml.org>  Wed, 09 Jun 2010 11:44:05 +0200
+  [ Christian Hofstaedtler ]
+  * Remove "read -s" bashism from target chroot script. [Closes: issue912].
+
+ -- Christian Hofstaedtler <ch@grml.org>  Mon, 18 Oct 2010 12:33:49 +0000
 
 grml-debootstrap (0.38) unstable; urgency=low