--- file_not_specified_in_diff +++ file_not_specified_in_diff @@ -, +, @@ --- dmcrypt.rc +++ dmcrypt.rc @@ -71,17 +71,24 @@ if [ -n "${key}" ] ; then read_abort() { # some colors - local ans - shift + local ans savetty resettty [ -z "${NORMAL}" ] && eval $(eval_ecolors) einfon " $1? (${WARN}yes${NORMAL}/${GOOD}No${NORMAL}) " - if ! read -n 1 $* ans ; then + shift + savetty=`stty -g` + resettty='stty ${savetty}; trap - EXIT HUP INT TERM' + trap 'eval "${resettty}"' EXIT HUP INT TERM + stty -icanon + [ "${1}" = -t ] && stty min 0 time "$(( $2 * 10 ))" + ans=`dd count=1 bs=1 2>/dev/null` || ans='' + eval "${resettty}" + if [ -z "${ans}" ] ; then printf '\r' else echo fi case ${ans} in - [yY]|[yY][eE][sS]) return 0;; + [yY]) return 0;; *) return 1;; esac }