Lines 2320-2356
Link Here
|
2320 |
} |
2320 |
} |
2321 |
|
2321 |
|
2322 |
start_LUKS() { |
2322 |
start_LUKS() { |
2323 |
# if key is set but neither ssh enabled or key device is given, find |
|
|
2324 |
# the key device |
2325 |
|
2323 |
|
2326 |
[ -n "${CRYPT_ROOT_KEY}" ] && [ -z "${CRYPT_ROOT_KEYDEV}" ] \ |
2324 |
[ -z "$1" -o "$1" == "root" ] && decrypt_root="1" |
2327 |
&& sleep 6 && bootstrapKey "ROOT" |
2325 |
[ -z "$1" -o "$1" == "swap" ] && decrypt_swap="1" |
2328 |
|
2326 |
|
2329 |
if [ -n "${CRYPT_ROOT}" ] |
2327 |
# if key is set but neither ssh enabled or key device is given, find |
2330 |
then |
2328 |
# the key device |
2331 |
openLUKS "root" |
2329 |
if [ -n "$decrypt_root" ] |
2332 |
if [ -n "${REAL_ROOT}" ] |
2330 |
then |
2333 |
then |
2331 |
|
2334 |
# Rescan volumes |
2332 |
[ -n "${CRYPT_ROOT_KEY}" ] && [ -z "${CRYPT_ROOT_KEYDEV}" ] \ |
2335 |
start_volumes |
2333 |
&& sleep 6 && bootstrapKey "ROOT" |
2336 |
else |
2334 |
|
2337 |
REAL_ROOT="/dev/mapper/root" |
2335 |
if [ -n "${CRYPT_ROOT}" ] |
2338 |
fi |
2336 |
then |
2339 |
fi |
2337 |
openLUKS "root" |
2340 |
|
2338 |
if [ -n "${REAL_ROOT}" ] |
2341 |
# same for swap, but no need to sleep if root was unencrypted |
2339 |
then |
2342 |
[ -n "${CRYPT_SWAP_KEY}" ] && [ -z "${CRYPT_SWAP_KEYDEV}" ] \ |
2340 |
# Rescan volumes |
2343 |
&& { [ -z "${CRYPT_ROOT}" ] && sleep 6; bootstrapKey "SWAP"; } |
2341 |
start_volumes |
2344 |
|
2342 |
else |
2345 |
if [ -n "${CRYPT_SWAP}" ] |
2343 |
REAL_ROOT="/dev/mapper/root" |
2346 |
then |
2344 |
fi |
2347 |
openLUKS "swap" |
2345 |
fi |
2348 |
if [ -z "${REAL_RESUME}" ] |
2346 |
|
2349 |
then |
2347 |
fi |
2350 |
# Resume from swap as default |
2348 |
|
2351 |
REAL_RESUME="/dev/mapper/swap" |
2349 |
if [ -n "$decrypt_swap" ] |
2352 |
fi |
2350 |
then |
2353 |
fi |
2351 |
# same for swap, but no need to sleep if root was unencrypted |
|
|
2352 |
[ -n "${CRYPT_SWAP_KEY}" ] && [ -z "${CRYPT_SWAP_KEYDEV}" ] \ |
2353 |
&& { [ -z "${CRYPT_ROOT}" ] && sleep 6; bootstrapKey "SWAP"; } |
2354 |
|
2355 |
if [ -n "${CRYPT_SWAP}" ] |
2356 |
then |
2357 |
openLUKS "swap" |
2358 |
if [ -z "${REAL_RESUME}" ] |
2359 |
then |
2360 |
# Resume from swap as default |
2361 |
REAL_RESUME="/dev/mapper/swap" |
2362 |
fi |
2363 |
fi |
2364 |
fi |
2354 |
} |
2365 |
} |
2355 |
|
2366 |
|
2356 |
start_sshd() { |
2367 |
start_sshd() { |