 2397 Alkis Georgopoulos	2012-10-29
      Add read_prompt function to ltsp-common-functions, which is ideally a shell
      agnostic implementation of "read -p". http://bugs.debian.org/690638

=== modified file 'client/share/ltsp/ltsp-cleanup'
--- old/client/share/ltsp/ltsp-cleanup	2012-05-30 04:52:16 +0000
+++ new/client/share/ltsp/ltsp-cleanup	2012-10-29 19:08:41 +0000
@@ -61,7 +61,7 @@
 by removing or regenerating sensitive data like user accounts and host keys.
 
 EOF
-    read -p "Are you sure you want to do that [Y/n]? " YES
+    read_prompt "Are you sure you want to do that [Y/n]? " YES
 fi
 if boolean_is_true "$YES"; then
     run_parts /usr/share/ltsp/cleanup.d /etc/ltsp/cleanup.d

=== modified file 'common/ltsp-common-functions'
--- old/common/ltsp-common-functions	2012-06-19 20:23:23 +0000
+++ new/common/ltsp-common-functions	2012-10-29 19:08:41 +0000
@@ -157,6 +157,17 @@
     unset MARKED_MOUNTS
 }
 
+read_prompt() {
+    # Shell agnostic "read -p" implementation
+
+    # Only output if on an interactive terminal
+    if [ -t 0 ]; then
+        echo -n "$1"
+    fi
+    shift
+    read "$@"
+}
+
 debug "Started"
 
 # Source tool-specific settings and functions, if they're provided

