/[gentoo-x86]/sys-fs/cryptsetup/files/dmcrypt.rc
Gentoo

Diff of /sys-fs/cryptsetup/files/dmcrypt.rc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.3 Revision 1.4
1#!/sbin/runscript 1#!/sbin/runscript
2# Copyright 1999-2012 Gentoo Foundation 2# Copyright 1999-2012 Gentoo Foundation
3# Distributed under the terms of the GNU General Public License v2 3# Distributed under the terms of the GNU General Public License v2
4# $Header: /var/cvsroot/gentoo-x86/sys-fs/cryptsetup/files/dmcrypt.rc,v 1.3 2012/05/11 08:18:10 vapier Exp $ 4# $Header: /var/cvsroot/gentoo-x86/sys-fs/cryptsetup/files/dmcrypt.rc,v 1.4 2012/05/11 08:33:01 vapier Exp $
5 5
6depend() { 6depend() {
7 before checkfs fsck 7 before checkfs fsck
8} 8}
9 9
69 69
70 # Handle keys 70 # Handle keys
71 if [ -n "${key}" ] ; then 71 if [ -n "${key}" ] ; then
72 read_abort() { 72 read_abort() {
73 # some colors 73 # some colors
74 local ans 74 local ans savetty resettty
75 shift
76 [ -z "${NORMAL}" ] && eval $(eval_ecolors) 75 [ -z "${NORMAL}" ] && eval $(eval_ecolors)
77 einfon " $1? (${WARN}yes${NORMAL}/${GOOD}No${NORMAL}) " 76 einfon " $1? (${WARN}yes${NORMAL}/${GOOD}No${NORMAL}) "
78 if ! read -n 1 $* ans ; then 77 shift
78 # This is ugly as s**t. But POSIX doesn't provide `read -t`, so
79 # we end up having to implement our own crap with stty/etc...
80 savetty=$(stty -g)
81 resettty='stty ${savetty}; trap - EXIT HUP INT TERM'
82 trap 'eval "${resettty}"' EXIT HUP INT TERM
83 stty -icanon
84 [ "${1}" = -t ] && stty min 0 time "$(( $2 * 10 ))"
85 ans=$(dd count=1 bs=1 2>/dev/null) || ans=''
86 eval "${resettty}"
87 if [ -z "${ans}" ] ; then
79 printf '\r' 88 printf '\r'
80 else 89 else
81 echo 90 echo
82 fi 91 fi
83 case ${ans} in 92 case ${ans} in
84 [yY]|[yY][eE][sS]) return 0;; 93 [yY]) return 0;;
85 *) return 1;; 94 *) return 1;;
86 esac 95 esac
87 } 96 }
88 97
89 # Notes: sed not used to avoid case where /usr partition is encrypted. 98 # Notes: sed not used to avoid case where /usr partition is encrypted.

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.20