Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 104381 | Differences between
and this patch

Collapse All | Expand All

(-)/usr/portage/sys-fs/cryptsetup-luks/files/dm-crypt-start.sh (-3 / +31 lines)
Lines 6-11 Link Here
6
# Setup mappings for an individual mount/swap
6
# Setup mappings for an individual mount/swap
7
#
7
#
8
# Note: This relies on variables localized in the main body below.
8
# Note: This relies on variables localized in the main body below.
9
9
dm-crypt-execute-checkfs() {
10
dm-crypt-execute-checkfs() {
10
	local dev target ret
11
	local dev target ret
11
12
Lines 40-51 Link Here
40
		eend ${ret} "failure running cryptsetup"
41
		eend ${ret} "failure running cryptsetup"
41
	elif [[ -n ${type} ]] ; then
42
	elif [[ -n ${type} ]] ; then
42
		einfo "/bin/cryptsetup ${options} luksOpen ${source} ${target}" 
43
		einfo "/bin/cryptsetup ${options} luksOpen ${source} ${target}" 
43
		/bin/cryptsetup ${options} luksOpen ${source} ${target} >/dev/console </dev/console
44
		if [[ -z ${master} ]] ; then
45
		    /bin/cryptsetup ${options} luksOpen ${source} ${target} >/dev/console </dev/console
44
		#/bin/cryptsetup ${options} luksOpen ${source} ${target} 
46
		#/bin/cryptsetup ${options} luksOpen ${source} ${target} 
47
		else
48
		    echo ${master} | /bin/cryptsetup ${options} luksOpen ${source} ${target} >/dev/console
49
		fi
45
		ret=$?
50
		ret=$?
46
		eend ${ret} "failure running cryptsetup-luks"
51
		eend ${ret} "failure running cryptsetup-luks"
47
	elif [[ -n ${key} ]] ; then
52
	elif [[ -n ${key} ]] ; then
48
		if type -p gpg >/dev/null ; then
53
		if type -p gpg >/dev/null ; then
54
		    if [[ -z ${master} ]] ; then
49
			ret=1
55
			ret=1
50
			while [[ ${ret} -gt 0 ]] ; do
56
			while [[ ${ret} -gt 0 ]] ; do
51
				keystring=$(gpg ${gpg_options} ${key} 2>/dev/null </dev/console)
57
				keystring=$(gpg ${gpg_options} ${key} 2>/dev/null </dev/console)
Lines 57-62 Link Here
57
				fi
63
				fi
58
			done
64
			done
59
			eend ${ret}
65
			eend ${ret}
66
		    else
67
			keystring=$(echo ${master} | gpg -q -d ${gpg_options} --passphrase-fd 0 ${key} 2>/dev/null)
68
			echo ${keystring} | /bin/cryptsetup ${options} create ${target} ${source}
69
			ret=0
70
		    fi
60
		else
71
		else
61
			einfo "You have to install app-crypt/gnupg first"
72
			einfo "You have to install app-crypt/gnupg first"
62
		fi
73
		fi
Lines 132-138 Link Here
132
					continue
143
					continue
133
				fi
144
				fi
134
				;;
145
				;;
135
146
		        master_key=*)
147
			        if [[ "${myservice}" = "checkfs" ]] ; then
148
				    if type -p gpg >/dev/null ; then
149
					ret=1
150
					while [[ ${ret} -gt 0 ]] ; do
151
			        # Get the master passphrase. 
152
					    ret=0
153
					    eval "${mountline}"
154
					    master=$(gpg -d -q ${gpg_options} ${master_key}  2>/dev/null </dev/console)
155
					    if [[ -z ${master} ]] ; then
156
						ret=5
157
					    fi
158
					done
159
					eend ${ret}
160
				    else
161
					einfo "You have to install app-crypt/gpg first"
162
				    fi
163
				fi
164
				;;
136
			*)
165
			*)
137
				ewarn "Skipping invalid line in /etc/conf.d/cryptfs: ${mountline}"
166
				ewarn "Skipping invalid line in /etc/conf.d/cryptfs: ${mountline}"
138
				;;
167
				;;
Lines 148-152 Link Here
148
	ewend ${cryptfs_status} "Failed to setup dm-crypt devices"
177
	ewend ${cryptfs_status} "Failed to setup dm-crypt devices"
149
fi
178
fi
150
179
151
152
# vim:ts=4
180
# vim:ts=4

Return to bug 104381