dustin
/
jenkinsagent
Archived
1
0
Fork 0

rootfs: Add fetch-sshkeys systemd generator

Using a systemd generator to automatically enable
*fetch-sshkeys@.service* unit instances allows multiple users' keys to
be specified on the kernel command line, without explicitly enabling
the corresponding units.
master
Dustin 2022-03-12 16:06:16 -06:00
parent 0f9c3281cf
commit cabd6f43fe
2 changed files with 25 additions and 1 deletions

View File

@ -0,0 +1,25 @@
#!/bin/sh
enable_unit() {
mkdir -p "${normaldir}"/multi-user.target.wants
ln -s /lib/systemd/system/"$1" "${normaldir}"/multi-user.target.wants/
}
normaldir="$1"
# shellcheck disable=SC2034
earlydir="$2"
# shellcheck disable=SC2034
latedir="$3"
# shellcheck disable=SC2046
set -- $(cat /proc/cmdline)
while [ $# -ge 1 ]; do
case "$1" in
sshkeys.*=*)
arg=${1#*.}
user=${arg%=*}
enable_unit fetch-sshkeys@"${user}".service
;;
esac
shift
done