Start dropbear by systemd unit if systemd is enabled.

The hook scripts are not run in systemd mode, so a systemd unit is
required. This adds a custom unit that has the right ordering and
command line to start dropbear before the crypto setup step.

Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
This commit is contained in:
Toke Høiland-Jørgensen 2016-05-07 23:05:55 +02:00
parent da78b4c0b4
commit de26d19079
2 changed files with 19 additions and 1 deletions

11
dropbear.service Normal file
View file

@ -0,0 +1,11 @@
[Unit]
Description=Dropbear SSH Daemon
DefaultDependencies=no
Before=cryptsetup.target
[Service]
Type=simple
ExecStart=/usr/bin/dropbear -F -s -j -k
[Install]
WantedBy=cryptsetup.target

View file

@ -92,7 +92,14 @@ build ()
add_dir "/var/log" add_dir "/var/log"
touch "${BUILDROOT}"/var/log/lastlog touch "${BUILDROOT}"/var/log/lastlog
add_runscript #systemd enabled
declare -F add_systemd_unit > /dev/null 2>&1
if [ $? -eq 0 ]; then
add_file "/usr/share/mkinitcpio-dropbear/dropbear.service" "/etc/systemd/system/dropbear.service"
systemctl --root "$BUILDROOT" enable dropbear.service
else
add_runscript
fi
} }
help () help ()