| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | |
| 3 | prereqsscip-shell shell shell-project 0.0.0 prereqs().() |
| 4 | { |
| 5 | # cryptroot-unlock needs to be run last among crypt* since other hooks might include askpass |
| 6 | local req script |
| 7 | for req in "${0%/*}"/crypt*; do |
| 8 | script="${req##*/}" |
| 9 | if [scip-shell system . . `[`. "$script" != "${0##*/}" ]; then |
| 10 | printfscip-shell system . . printf. '%s\n' "$script" |
| 11 | fi |
| 12 | done |
| 13 | } |
| 14 | |
| 15 | case "$1" in |
| 16 | prereqs) |
| 17 | prereqsscip-shell shell shell-project 0.0.0 prereqs(). |
| 18 | exit 0 |
| 19 | ;; |
| 20 | esac |
| 21 | |
| 22 | if [scip-shell system . . `[`. ! -f "$DESTDIR/lib/cryptsetup/askpass" ]; then |
| 23 | # cryptroot-unlock is useless without askpass |
| 24 | exit 0 |
| 25 | fi |
| 26 | |
| 27 | . /usr/share/initramfs-tools/hook-functionsscip-shell source . . `/usr/share/initramfs-tools/hook-functions`. |
| 28 | if [scip-shell system . . `[`. ! -f "$DESTDIR/bin/cryptroot-unlock" ] && |
| 29 | ! copy_file script /usr/share/cryptsetup/initramfs/bin/cryptroot-unlockscip-shell filesystem . . `/usr/share/cryptsetup/initramfs/bin/cryptroot-unlock`. /bin/cryptroot-unlockscip-shell filesystem . . `/bin/cryptroot-unlock`.; then |
| 30 | echoscip-shell system . . echo. "ERROR: Couldn't copy /bin/cryptroot-unlock" >&2 |
| 31 | exit 1 |
| 32 | fi |
| 33 | |
| 34 | if [scip-shell system . . `[`. -f /etc/initramfs-tools/etc/motdscip-shell filesystem . . `/etc/initramfs-tools/etc/motd`. ]; then |
| 35 | copy_file text /etc/initramfs-tools/etc/motdscip-shell filesystem . . `/etc/initramfs-tools/etc/motd`. /etc/motdscip-shell filesystem . . `/etc/motd`. |
| 36 | else |
| 37 | catscip-shell system . . cat. >>"$DESTDIR/etc/motd" <<- EOF |
| 38 | To unlock root partition, and maybe others like swap, run \`cryptroot-unlock\`. |
| 39 | EOF |
| 40 | fi |