aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2016-02-26 23:31:31 +0100
committerGravatar Christian Hesse <mail@eworm.de>2016-05-22 20:44:26 +0200
commit0d250492b5ce1f01040898da7eba7db5df4f07be (patch)
treeca5a5d879d95d994bdb8b71374219a630853cbba
parentb6cc20e9c27ddf4b4ca8a58ef7aa990885229157 (diff)
downloadmkinitcpio-ykfde-0d250492b5ce1f01040898da7eba7db5df4f07be.tar.gz
mkinitcpio-ykfde-0d250492b5ce1f01040898da7eba7db5df4f07be.tar.zst
drop shell script and implement with systemd units
-rw-r--r--mkinitcpio/ykfde12
-rw-r--r--systemd/ykfde-2f18
-rw-r--r--systemd/ykfde-2f.service2
-rw-r--r--systemd/ykfde-notify.service18
4 files changed, 23 insertions, 27 deletions
diff --git a/mkinitcpio/ykfde b/mkinitcpio/ykfde
index 5a407f5..4932dfd 100644
--- a/mkinitcpio/ykfde
+++ b/mkinitcpio/ykfde
@@ -11,15 +11,11 @@ build() {
add_systemd_unit cryptsetup-pre.target
add_systemd_unit ykfde-2f.service
add_symlink /usr/lib/systemd/system/sysinit.target.wants/ykfde-2f.service ../ykfde-2f.service
- add_file /usr/lib/systemd/scripts/ykfde-2f
+ add_systemd_unit ykfde-notify.service
+ add_symlink /usr/lib/systemd/system/sysinit.target.wants/ykfde-notify.service ../ykfde-notify.service
add_binary systemd-ask-password
-
- # shell and commands
- local applet
- add_binary /usr/lib/initcpio/busybox /usr/bin/busybox
- for applet in cat kill sh sleep; do
- add_symlink "/usr/bin/${applet}" busybox
- done
+ add_binary pkill
+ add_binary sleep
fi
}
diff --git a/systemd/ykfde-2f b/systemd/ykfde-2f
deleted file mode 100644
index c34bde8..0000000
--- a/systemd/ykfde-2f
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-# (C) 2016 by Christian Hesse <mail@eworm.de>
-#
-# This software may be used and distributed according to the terms
-# of the GNU General Public License, incorporated herein by reference.
-
-systemd-ask-password --no-tty --keyname='ykfde-2f' 'Please enter second factor for Yubikey full disk encryption!' >/dev/null
-
-if [ -s '/run/ykfde.pid' ]; then
- kill -USR1 $(cat '/run/ykfde.pid')
- # ykfde started from udev needs a moment to set up the key
- # in store. It is out of systemd control, so wait a moment
- # here.
- sleep 0.2
-fi
-
-true
diff --git a/systemd/ykfde-2f.service b/systemd/ykfde-2f.service
index cfdab43..f514c7d 100644
--- a/systemd/ykfde-2f.service
+++ b/systemd/ykfde-2f.service
@@ -14,4 +14,4 @@ ConditionPathExists=/etc/ykfde.d/
Type=oneshot
RemainAfterExit=yes
TimeoutSec=0
-ExecStart=/usr/lib/systemd/scripts/ykfde-2f
+ExecStart=/usr/bin/systemd-ask-password --no-tty --keyname='ykfde-2f' 'Please enter second factor for Yubikey full disk encryption!'
diff --git a/systemd/ykfde-notify.service b/systemd/ykfde-notify.service
new file mode 100644
index 0000000..e77f634
--- /dev/null
+++ b/systemd/ykfde-notify.service
@@ -0,0 +1,18 @@
+# (C) 2016 by Christian Hesse <mail@eworm.de>
+#
+# This software may be used and distributed according to the terms
+# of the GNU General Public License, incorporated herein by reference.
+
+[Unit]
+Description=Notify ykfde about key
+DefaultDependencies=no
+Before=cryptsetup-pre.target
+Wants=cryptsetup-pre.target
+Requires=ykfde-2f.service
+ConditionPathExists=/run/ykfde.pid
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/usr/bin/pkill -USR1 --pidfile /run/ykfde.pid
+ExecStart=/usr/bin/sleep 0.2