1 |
strerror 07/10/02 15:47:28 |
2 |
|
3 |
Modified: 1.0.5-dmcrypt.rc 1.0.5-dm-crypt-stop.sh |
4 |
1.0.5-dm-crypt-start.sh |
5 |
Added: digest-cryptsetup-1.0.5-r1 |
6 |
Log: |
7 |
Fixes for bugs #180068 #181503 #164795 and other improvements. Thanks to Thomas Bettler for a patch |
8 |
(Portage version: 2.1.3.11) |
9 |
|
10 |
Revision Changes Path |
11 |
1.2 sys-fs/cryptsetup/files/1.0.5-dmcrypt.rc |
12 |
|
13 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/cryptsetup/files/1.0.5-dmcrypt.rc?rev=1.2&view=markup |
14 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/cryptsetup/files/1.0.5-dmcrypt.rc?rev=1.2&content-type=text/plain |
15 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/cryptsetup/files/1.0.5-dmcrypt.rc?r1=1.1&r2=1.2 |
16 |
|
17 |
Index: 1.0.5-dmcrypt.rc |
18 |
=================================================================== |
19 |
RCS file: /var/cvsroot/gentoo-x86/sys-fs/cryptsetup/files/1.0.5-dmcrypt.rc,v |
20 |
retrieving revision 1.1 |
21 |
retrieving revision 1.2 |
22 |
diff -u -r1.1 -r1.2 |
23 |
--- 1.0.5-dmcrypt.rc 14 Aug 2007 16:05:16 -0000 1.1 |
24 |
+++ 1.0.5-dmcrypt.rc 2 Oct 2007 15:47:27 -0000 1.2 |
25 |
@@ -1,10 +1,13 @@ |
26 |
#!/sbin/runscript |
27 |
# Copyright 1999-2007 Gentoo Foundation |
28 |
# Distributed under the terms of the GNU General Public License v2 |
29 |
-# $Header: /var/cvsroot/gentoo-x86/sys-fs/cryptsetup/files/1.0.5-dmcrypt.rc,v 1.1 2007/08/14 16:05:16 strerror Exp $ |
30 |
+# $Header: /var/cvsroot/gentoo-x86/sys-fs/cryptsetup/files/1.0.5-dmcrypt.rc,v 1.2 2007/10/02 15:47:27 strerror Exp $ |
31 |
|
32 |
depend() { |
33 |
before checkfs |
34 |
+ if [ -e /lib/librc.so ]; then |
35 |
+ need device-mapper |
36 |
+ fi |
37 |
} |
38 |
|
39 |
start() { |
40 |
|
41 |
|
42 |
|
43 |
1.2 sys-fs/cryptsetup/files/1.0.5-dm-crypt-stop.sh |
44 |
|
45 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/cryptsetup/files/1.0.5-dm-crypt-stop.sh?rev=1.2&view=markup |
46 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/cryptsetup/files/1.0.5-dm-crypt-stop.sh?rev=1.2&content-type=text/plain |
47 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/cryptsetup/files/1.0.5-dm-crypt-stop.sh?r1=1.1&r2=1.2 |
48 |
|
49 |
Index: 1.0.5-dm-crypt-stop.sh |
50 |
=================================================================== |
51 |
RCS file: /var/cvsroot/gentoo-x86/sys-fs/cryptsetup/files/1.0.5-dm-crypt-stop.sh,v |
52 |
retrieving revision 1.1 |
53 |
retrieving revision 1.2 |
54 |
diff -u -r1.1 -r1.2 |
55 |
--- 1.0.5-dm-crypt-stop.sh 14 Aug 2007 16:05:16 -0000 1.1 |
56 |
+++ 1.0.5-dm-crypt-stop.sh 2 Oct 2007 15:47:27 -0000 1.2 |
57 |
@@ -1,12 +1,12 @@ |
58 |
# /lib/rcscripts/addons/dm-crypt-stop.sh |
59 |
|
60 |
# Try to remove any dm-crypt mappings |
61 |
-csetup=/bin/cryptsetup |
62 |
-if [ -f /etc/conf.d/cryptfs ] && [ -x "$csetup" ] |
63 |
+csetup=/sbin/cryptsetup |
64 |
+if [ -f /etc/conf.d/dmcrypt ] && [ -x "$csetup" ] |
65 |
then |
66 |
einfo "Removing dm-crypt mappings" |
67 |
|
68 |
- /bin/egrep "^(target|swap)" /etc/conf.d/cryptfs | \ |
69 |
+ /bin/egrep "^(target|swap)" /etc/conf.d/dmcrypt | \ |
70 |
while read targetline |
71 |
do |
72 |
target= |
73 |
@@ -15,16 +15,16 @@ |
74 |
eval ${targetline} |
75 |
|
76 |
[ -n "${swap}" ] && target=${swap} |
77 |
- [ -z "${target}" ] && ewarn "Invalid line in /etc/conf.d/cryptfs: ${targetline}" |
78 |
+ [ -z "${target}" ] && ewarn "Invalid line in /etc/conf.d/dmcrypt: ${targetline}" |
79 |
|
80 |
ebegin "Removing dm-crypt mapping for: ${target}" |
81 |
${csetup} remove ${target} |
82 |
eend $? "Failed to remove dm-crypt mapping for: ${target}" |
83 |
done |
84 |
|
85 |
- if [[ -n $(/bin/egrep -e "^(source=)./dev/loop*" /etc/conf.d/cryptfs) ]] ; then |
86 |
+ if [[ -n $(/bin/egrep -e "^(source=)./dev/loop*" /etc/conf.d/dmcrypt) ]] ; then |
87 |
einfo "Taking down any dm-crypt loop devices" |
88 |
- /bin/egrep -e "^(source)" /etc/conf.d/cryptfs | while read sourceline |
89 |
+ /bin/egrep -e "^(source)" /etc/conf.d/dmcrypt | while read sourceline |
90 |
do |
91 |
source= |
92 |
eval ${sourceline} |
93 |
|
94 |
|
95 |
|
96 |
1.3 sys-fs/cryptsetup/files/1.0.5-dm-crypt-start.sh |
97 |
|
98 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/cryptsetup/files/1.0.5-dm-crypt-start.sh?rev=1.3&view=markup |
99 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/cryptsetup/files/1.0.5-dm-crypt-start.sh?rev=1.3&content-type=text/plain |
100 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/cryptsetup/files/1.0.5-dm-crypt-start.sh?r1=1.2&r2=1.3 |
101 |
|
102 |
Index: 1.0.5-dm-crypt-start.sh |
103 |
=================================================================== |
104 |
RCS file: /var/cvsroot/gentoo-x86/sys-fs/cryptsetup/files/1.0.5-dm-crypt-start.sh,v |
105 |
retrieving revision 1.2 |
106 |
retrieving revision 1.3 |
107 |
diff -u -r1.2 -r1.3 |
108 |
--- 1.0.5-dm-crypt-start.sh 15 Aug 2007 20:51:19 -0000 1.2 |
109 |
+++ 1.0.5-dm-crypt-start.sh 2 Oct 2007 15:47:27 -0000 1.3 |
110 |
@@ -20,6 +20,14 @@ |
111 |
# let user set options, otherwise leave empty |
112 |
: ${options:=' '} |
113 |
elif [ -n "$swap" ]; then |
114 |
+ local foo |
115 |
+ einfo "Checking swap is not LUKS" |
116 |
+ cryptsetup isLuks ${source} 2>/dev/null >/dev/console </dev/console |
117 |
+ foo="$?" |
118 |
+ if [ "${foo}" -eq 0 ]; then |
119 |
+ ewarn "The swap you have defined is a LUKS partition. Aborting crypt-swap setup." |
120 |
+ return |
121 |
+ fi |
122 |
target=${swap} |
123 |
# swap contents do not need to be preserved between boots, luks not required. |
124 |
# suspend2 users should have initramfs's init handling their swap partition either way. |
125 |
@@ -50,6 +58,7 @@ |
126 |
einfo "dm-crypt mapping ${target} is already configured" |
127 |
return |
128 |
fi |
129 |
+ splash svc_input_begin ${SVCNAME} >/dev/null 2>&1 |
130 |
# Handle keys |
131 |
if [ -n "$key" ]; then |
132 |
# Notes: sed not used to avoid case where /usr partition is encrypted. |
133 |
@@ -72,10 +81,10 @@ |
134 |
umount -n ${mntrem} 2>/dev/null >/dev/null |
135 |
rmdir ${mntrem} 2>/dev/null >/dev/null |
136 |
einfo "Cannot find ${key} on removable media." |
137 |
- echo -n -e " ${green}*${off} Abort?(${red}yes${off}/${green}no${off})" >/dev/console |
138 |
- read ans </dev/console |
139 |
+ echo -n -e " ${green}*${off} Abort?(${red}yes${off}/${green}no${off})" >/dev/console |
140 |
+ read ${read_timeout} ans </dev/console |
141 |
echo >/dev/console |
142 |
- [ "$ans" != "yes" ] && { i=0; c=0; } || return |
143 |
+ [ "$ans" = "no" ] && { i=0; c=0; } || return |
144 |
else |
145 |
key="${mntrem}${key}" |
146 |
break |
147 |
@@ -89,9 +98,9 @@ |
148 |
rmdir ${mntrem} 2>/dev/null >/dev/null |
149 |
einfo "Removable device for ${target} not present." |
150 |
echo -n -e " ${green}*${off} Abort?(${red}yes${off}/${green}no${off})" >/dev/console |
151 |
- read ans </dev/console |
152 |
+ read ${read_timeout} ans </dev/console |
153 |
echo >/dev/console |
154 |
- [ "$ans" != "yes" ] && { i=0; c=0; } || return |
155 |
+ [ "$ans" = "no" ] && { i=0; c=0; } || return |
156 |
fi |
157 |
fi |
158 |
done |
159 |
@@ -112,7 +121,6 @@ |
160 |
else |
161 |
mode=none |
162 |
fi |
163 |
- splash svc_input_begin ${SVCNAME} >/dev/null 2>&1 |
164 |
ebegin "dm-crypt map ${target}" |
165 |
einfo "cryptsetup will be called with : ${options} ${arg1} ${arg2} ${arg3}" |
166 |
if [ "$mode" == "gpg" ]; then |
167 |
@@ -195,9 +203,44 @@ |
168 |
fi |
169 |
} |
170 |
|
171 |
+# Determine string lengths |
172 |
+strlen() { |
173 |
+ if [ -z "$1" ] |
174 |
+ then |
175 |
+ echo "usage: strlen <variable_name>" |
176 |
+ die |
177 |
+ fi |
178 |
+ eval echo "\${#${1}}" |
179 |
+} |
180 |
+ |
181 |
+# Lookup optional bootparams |
182 |
+parse_opt() { |
183 |
+ case "$1" in |
184 |
+ *\=*) |
185 |
+ local key_name="`echo "$1" | cut -f1 -d=`" |
186 |
+ local key_len=`strlen key_name` |
187 |
+ local value_start=$((key_len+2)) |
188 |
+ echo "$1" | cut -c ${value_start}- |
189 |
+ ;; |
190 |
+ esac |
191 |
+} |
192 |
+ |
193 |
local cryptfs_status=0 |
194 |
local gpg_options key loop_file target targetline options pre_mount post_mount source swap remdev |
195 |
|
196 |
+CMDLINE="`cat /proc/cmdline`" |
197 |
+for x in ${CMDLINE} |
198 |
+do |
199 |
+ case "${x}" in |
200 |
+ key_timeout\=*) |
201 |
+ KEY_TIMEOUT=`parse_opt "${x}"` |
202 |
+ if [ ${KEY_TIMEOUT} -gt 0 ]; then |
203 |
+ read_timeout="-t ${KEY_TIMEOUT}" |
204 |
+ fi |
205 |
+ ;; |
206 |
+ esac |
207 |
+done |
208 |
+ |
209 |
if [[ -f /etc/conf.d/dmcrypt ]] && [[ -x /sbin/cryptsetup ]] ; then |
210 |
ebegin "Setting up dm-crypt mappings" |
211 |
|
212 |
|
213 |
|
214 |
|
215 |
1.1 sys-fs/cryptsetup/files/digest-cryptsetup-1.0.5-r1 |
216 |
|
217 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/cryptsetup/files/digest-cryptsetup-1.0.5-r1?rev=1.1&view=markup |
218 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/cryptsetup/files/digest-cryptsetup-1.0.5-r1?rev=1.1&content-type=text/plain |
219 |
|
220 |
Index: digest-cryptsetup-1.0.5-r1 |
221 |
=================================================================== |
222 |
MD5 0aa2f94c39123f1a0352983e5366179c cryptsetup-1.0.5.tar.bz2 322394 |
223 |
RMD160 99d9b0090b297b1bc2c72c064f091c8b2f322f70 cryptsetup-1.0.5.tar.bz2 322394 |
224 |
SHA256 4bab529afa00cafde3bc5df2769578c88438f80c5152d4257cd0e86986f95bc4 cryptsetup-1.0.5.tar.bz2 322394 |
225 |
|
226 |
|
227 |
|
228 |
-- |
229 |
gentoo-commits@g.o mailing list |