bzr branch
http://bzr.recompile.se/loggerhead/mandos/trunk
|
1326
by Teddy Hogeborn
Fix kernel command line option "mandos=connect:<ip>:<port>" with dracut |
1 |
#!/bin/sh
|
2 |
#
|
|
3 |
# This file should be present in the root file system directory
|
|
4 |
# /usr/lib/dracut/modules.d/90mandos. When dracut creates the
|
|
5 |
# initramfs image, dracut will run the "module-setup.sh" file in the
|
|
6 |
# same directory, which (when using the "systemd" dracut module) will
|
|
7 |
# copy this file ("cmdline-mandos-systemd.sh") into the initramfs as
|
|
8 |
# "/lib/dracut/hooks/cmdline/20-cmdline-mandos-systemd.sh".
|
|
9 |
#
|
|
10 |
# Despite the above #!/bin/sh line and the executable flag, this file
|
|
11 |
# is not executed; this file is sourced by the /init script in the
|
|
12 |
# initramfs image created by dracut.
|
|
13 |
||
14 |
type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh |
|
15 |
||
16 |
if getargbool 1 mandos && [ -e /lib/dracut-crypt-lib.sh ]; then |
|
17 |
if mandos=$(getarg mandos); then |
|
18 |
case "$mandos" in |
|
19 |
connect:*) mandos_connect="${mandos#connect:}" ;; |
|
20 |
esac |
|
21 |
if [ -n "$mandos_connect" ]; then |
|
22 |
# systemd >= 254 |
|
23 |
# systemctl edit --runtime ask-password-mandos.service --stdin <<-EOF |
|
24 |
# ... |
|
25 |
# EOF |
|
26 |
mkdir --parents /run/systemd/system/ask-password-mandos.service.d |
|
27 |
cat > /run/systemd/system/ask-password-mandos.service.d/connect.conf <<-EOF |
|
28 |
[Service]
|
|
29 |
Environment="MANDOS_CLIENT_CONNECT=--connect=$mandos_connect"
|
|
30 |
EOF
|
|
31 |
systemctl daemon-reload |
|
32 |
fi |
|
33 |
fi |
|
34 |
fi
|