aboutsummarylogtreecommitdiffstats
path: root/sd-keyscript
blob: fe232d99fe314297cf0a7a510c85fe7b39bb1f95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh

build() {
    add_file "/usr/lib/systemd/system/systemd-keyscript@.service"
    add_full_dir "/etc/systemd-keyscript/initramfs"
    mv $BUILDROOT/etc/systemd-keyscript/initramfs/* "$BUILDROOT/etc/systemd-keyscript/"

    # enable all systemd units for existing script files
    for scriptpath in $BUILDROOT/etc/systemd-keyscript/scripts/*.sh; do
        fullname=$(basename "$scriptpath")
        filename="${fullname%.*}"
        wants="/usr/lib/systemd/system/systemd-cryptsetup@$filename.service.wants"

        mkdir -p "$BUILDROOT$wants"
        add_symlink "$wants/systemd-keyscript@$filename.service" \
        "/usr/lib/systemd/system/systemd-keyscript@.service"
    done
}

help() {
    cat <<HELPEOF
This hook adds systemd units to run script files before encrypted disks are decrypted
HELPEOF
}