|
Harald Hoyer |
811c04 |
From 3d352f522837ce8dc20ae130f79462e5a3cce347 Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
811c04 |
From: Harald Hoyer <harald@redhat.com>
|
|
Harald Hoyer |
811c04 |
Date: Mon, 30 Jul 2012 14:34:55 +0200
|
|
Harald Hoyer |
811c04 |
Subject: [PATCH] crypt: add systemd crypt support
|
|
Harald Hoyer |
811c04 |
|
|
Harald Hoyer |
811c04 |
---
|
|
Harald Hoyer |
811c04 |
modules.d/90crypt/crypt-run-generator.sh | 10 +++++++
|
|
Harald Hoyer |
811c04 |
modules.d/90crypt/module-setup.sh | 13 ++++++++-
|
|
Harald Hoyer |
811c04 |
modules.d/90crypt/parse-crypt.sh | 46 ++++++++++++++++++++++----------
|
|
Harald Hoyer |
811c04 |
3 files changed, 54 insertions(+), 15 deletions(-)
|
|
Harald Hoyer |
811c04 |
create mode 100755 modules.d/90crypt/crypt-run-generator.sh
|
|
Harald Hoyer |
811c04 |
|
|
Harald Hoyer |
811c04 |
diff --git a/modules.d/90crypt/crypt-run-generator.sh b/modules.d/90crypt/crypt-run-generator.sh
|
|
Harald Hoyer |
811c04 |
new file mode 100755
|
|
Harald Hoyer |
811c04 |
index 0000000..d70443e
|
|
Harald Hoyer |
811c04 |
--- /dev/null
|
|
Harald Hoyer |
811c04 |
+++ b/modules.d/90crypt/crypt-run-generator.sh
|
|
Harald Hoyer |
811c04 |
@@ -0,0 +1,10 @@
|
|
Harald Hoyer |
811c04 |
+#!/bin/bash
|
|
Harald Hoyer |
811c04 |
+
|
|
Harald Hoyer |
811c04 |
+dev=$1
|
|
Harald Hoyer |
811c04 |
+luks=$2
|
|
Harald Hoyer |
811c04 |
+
|
|
Harald Hoyer |
811c04 |
+echo "$luks $dev" >> /etc/crypttab
|
|
Harald Hoyer |
811c04 |
+/lib/systemd/system-generators/systemd-cryptsetup-generator
|
|
Harald Hoyer |
811c04 |
+systemctl daemon-reload
|
|
Harald Hoyer |
811c04 |
+systemctl start cryptsetup.target
|
|
Harald Hoyer |
811c04 |
+exit 0
|
|
Harald Hoyer |
811c04 |
diff --git a/modules.d/90crypt/module-setup.sh b/modules.d/90crypt/module-setup.sh
|
|
Harald Hoyer |
811c04 |
index 9b0bf64..b6d97af 100755
|
|
Harald Hoyer |
811c04 |
--- a/modules.d/90crypt/module-setup.sh
|
|
Harald Hoyer |
811c04 |
+++ b/modules.d/90crypt/module-setup.sh
|
|
Harald Hoyer |
811c04 |
@@ -49,5 +49,16 @@ install() {
|
|
Harald Hoyer |
811c04 |
inst_hook cleanup 30 "$moddir/crypt-cleanup.sh"
|
|
Harald Hoyer |
811c04 |
inst_simple /etc/crypttab
|
|
Harald Hoyer |
811c04 |
inst_simple "$moddir/crypt-lib.sh" "/lib/dracut-crypt-lib.sh"
|
|
Harald Hoyer |
811c04 |
-}
|
|
Harald Hoyer |
811c04 |
|
|
Harald Hoyer |
811c04 |
+ dracut_install -o \
|
|
Harald Hoyer |
811c04 |
+ $systemdutildir/system-generators/systemd-cryptsetup-generator \
|
|
Harald Hoyer |
811c04 |
+ $systemdutildir/system-generators/systemd-cryptsetup-generator \
|
|
Harald Hoyer |
811c04 |
+ $systemdutildir/systemd-cryptsetup \
|
|
Harald Hoyer |
811c04 |
+ $systemdsystemunitdir/systemd-ask-password-console.path \
|
|
Harald Hoyer |
811c04 |
+ $systemdsystemunitdir/systemd-ask-password-console.service \
|
|
Harald Hoyer |
811c04 |
+ $systemdsystemunitdir/cryptsetup.target \
|
|
Harald Hoyer |
811c04 |
+ $systemdsystemunitdir/sysinit.target.wants/cryptsetup.target \
|
|
Harald Hoyer |
811c04 |
+ systemd-ask-password systemd-tty-ask-password-agent
|
|
Harald Hoyer |
811c04 |
+ inst_hook initqueue/finished 01 "$moddir/finished-ask-password.sh"
|
|
Harald Hoyer |
811c04 |
+ inst_script "$moddir"/crypt-run-generator.sh /sbin/crypt-run-generator
|
|
Harald Hoyer |
811c04 |
+}
|
|
Harald Hoyer |
811c04 |
diff --git a/modules.d/90crypt/parse-crypt.sh b/modules.d/90crypt/parse-crypt.sh
|
|
Harald Hoyer |
811c04 |
index e20e6e0..8d1c8cd 100755
|
|
Harald Hoyer |
811c04 |
--- a/modules.d/90crypt/parse-crypt.sh
|
|
Harald Hoyer |
811c04 |
+++ b/modules.d/90crypt/parse-crypt.sh
|
|
Harald Hoyer |
811c04 |
@@ -2,8 +2,6 @@
|
|
Harald Hoyer |
811c04 |
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
|
Harald Hoyer |
811c04 |
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
|
Harald Hoyer |
811c04 |
|
|
Harald Hoyer |
811c04 |
-[ -n "$DRACUT_SYSTEMD" ] && exit 0
|
|
Harald Hoyer |
811c04 |
-
|
|
Harald Hoyer |
811c04 |
if ! getargbool 1 rd.luks -d -n rd_NO_LUKS; then
|
|
Harald Hoyer |
811c04 |
info "rd.luks=0: removing cryptoluks activation"
|
|
Harald Hoyer |
811c04 |
rm -f /etc/udev/rules.d/70-luks.rules
|
|
Harald Hoyer |
811c04 |
@@ -18,14 +16,26 @@ else
|
|
Harald Hoyer |
811c04 |
|
|
Harald Hoyer |
811c04 |
if [ -n "$LUKS" ]; then
|
|
Harald Hoyer |
811c04 |
for luksid in $LUKS; do
|
|
Harald Hoyer |
811c04 |
+
|
|
Harald Hoyer |
811c04 |
luksid=${luksid##luks-}
|
|
Harald Hoyer |
811c04 |
- {
|
|
Harald Hoyer |
811c04 |
- printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
|
|
Harald Hoyer |
811c04 |
- printf -- 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
|
|
Harald Hoyer |
811c04 |
- printf -- 'RUN+="%s --unique --onetime ' $(command -v initqueue)
|
|
Harald Hoyer |
811c04 |
- printf -- '--name cryptroot-ask-%%k %s ' $(command -v cryptroot-ask)
|
|
Harald Hoyer |
811c04 |
- printf -- '$env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $tout
|
|
Harald Hoyer |
811c04 |
- } >> /etc/udev/rules.d/70-luks.rules.new
|
|
Harald Hoyer |
811c04 |
+
|
|
Harald Hoyer |
811c04 |
+ if [ -z "$DRACUT_SYSTEMD" ]; then
|
|
Harald Hoyer |
811c04 |
+ {
|
|
Harald Hoyer |
811c04 |
+ printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
|
|
Harald Hoyer |
811c04 |
+ printf -- 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
|
|
Harald Hoyer |
811c04 |
+ printf -- 'RUN+="%s --unique --onetime ' $(command -v initqueue)
|
|
Harald Hoyer |
811c04 |
+ printf -- '--name cryptroot-ask-%%k %s ' $(command -v cryptroot-ask)
|
|
Harald Hoyer |
811c04 |
+ printf -- '$env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $tout
|
|
Harald Hoyer |
811c04 |
+ } >> /etc/udev/rules.d/70-luks.rules.new
|
|
Harald Hoyer |
811c04 |
+ else
|
|
Harald Hoyer |
811c04 |
+ {
|
|
Harald Hoyer |
811c04 |
+ printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
|
|
Harald Hoyer |
811c04 |
+ printf -- 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
|
|
Harald Hoyer |
811c04 |
+ printf -- 'RUN+="%s --unique --onetime ' $(command -v initqueue)
|
|
Harald Hoyer |
811c04 |
+ printf -- '--name crypt-run-generator-%%k %s ' $(command -v crypt-run-generator)
|
|
Harald Hoyer |
811c04 |
+ printf -- '$env{DEVNAME} luks-$env{ID_FS_UUID}"\n'
|
|
Harald Hoyer |
811c04 |
+ } >> /etc/udev/rules.d/70-luks.rules.new
|
|
Harald Hoyer |
811c04 |
+ fi
|
|
Harald Hoyer |
811c04 |
|
|
Harald Hoyer |
811c04 |
uuid=$luksid
|
|
Harald Hoyer |
811c04 |
while [ "$uuid" != "${uuid#*-}" ]; do uuid=${uuid%%-*}${uuid#*-}; done
|
|
Harald Hoyer |
811c04 |
@@ -38,11 +48,19 @@ else
|
|
Harald Hoyer |
811c04 |
} >> $hookdir/emergency/90-crypt.sh
|
|
Harald Hoyer |
811c04 |
done
|
|
Harald Hoyer |
811c04 |
else
|
|
Harald Hoyer |
811c04 |
- {
|
|
Harald Hoyer |
811c04 |
- printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' $(command -v initqueue)
|
|
Harald Hoyer |
811c04 |
- printf -- '--unique --onetime --name cryptroot-ask-%%k '
|
|
Harald Hoyer |
811c04 |
- printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $(command -v cryptroot-ask) $tout
|
|
Harald Hoyer |
811c04 |
- } >> /etc/udev/rules.d/70-luks.rules.new
|
|
Harald Hoyer |
811c04 |
+ if [ -z "$DRACUT_SYSTEMD" ]; then
|
|
Harald Hoyer |
811c04 |
+ {
|
|
Harald Hoyer |
811c04 |
+ printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' $(command -v initqueue)
|
|
Harald Hoyer |
811c04 |
+ printf -- '--unique --onetime --name cryptroot-ask-%%k '
|
|
Harald Hoyer |
811c04 |
+ printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $(command -v cryptroot-ask) $tout
|
|
Harald Hoyer |
811c04 |
+ } >> /etc/udev/rules.d/70-luks.rules.new
|
|
Harald Hoyer |
811c04 |
+ else
|
|
Harald Hoyer |
811c04 |
+ {
|
|
Harald Hoyer |
811c04 |
+ printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' $(command -v initqueue)
|
|
Harald Hoyer |
811c04 |
+ printf -- '--unique --onetime --name crypt-run-generator-%%k '
|
|
Harald Hoyer |
811c04 |
+ printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID}"\n' $(command -v crypt-run-generator)
|
|
Harald Hoyer |
811c04 |
+ } >> /etc/udev/rules.d/70-luks.rules.new
|
|
Harald Hoyer |
811c04 |
+ fi
|
|
Harald Hoyer |
811c04 |
fi
|
|
Harald Hoyer |
811c04 |
|
|
Harald Hoyer |
811c04 |
echo 'LABEL="luks_end"' >> /etc/udev/rules.d/70-luks.rules.new
|