diff options
Diffstat (limited to 'initramfs-tools/hooks/samizdat')
-rwxr-xr-x | initramfs-tools/hooks/samizdat | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/initramfs-tools/hooks/samizdat b/initramfs-tools/hooks/samizdat index 1d4c1fe..fb424e6 100755 --- a/initramfs-tools/hooks/samizdat +++ b/initramfs-tools/hooks/samizdat | |||
@@ -1,21 +1,20 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | [ "$1" = prereqs ] && { echo; exit; } | 2 | [ "$1" = prereqs ] && { echo; exit; } |
3 | |||
4 | . /usr/share/initramfs-tools/hook-functions | 3 | . /usr/share/initramfs-tools/hook-functions |
5 | 4 | ||
5 | OUR_BINPATH=/usr/local/lib/samizdat/initrd/bin | ||
6 | |||
7 | # This insanity is necessary for initramfs-tools. | ||
8 | # TODO: File bug against initramfs-tools. | ||
9 | PATH=$OUR_BINPATH:$PATH | ||
10 | |||
6 | die() { printf 'Error: generating initramfs: %s\n' "$*" >&2; exit 1; } | 11 | die() { printf 'Error: generating initramfs: %s\n' "$*" >&2; exit 1; } |
7 | 12 | ||
8 | CopyExec() { copy_exec "$@" || die "failed to copy_exec $*"; } | 13 | CopyExec() { copy_exec "$@" || die "failed to copy_exec $*"; } |
9 | CopyExecE() { [ "$2" ] || die "cannot find binary to copy: $1"; shift; CopyExec "$@"; } | 14 | CopyExecE() { [ "$2" ] || die "cannot find binary to copy: $1"; shift; CopyExec "$@"; } |
10 | 15 | ||
11 | SAMIZDAT_INITRD_PATH=/usr/local/lib/samizdat-rhizome/initrd | ||
12 | |||
13 | PATH=${SAMIZDAT_INITRD_PATH}:/usr/local/bin:$PATH | ||
14 | |||
15 | repo_execs=$(echo "${SAMIZDAT_INITRD_PATH}"/*) | ||
16 | |||
17 | path_execs=' | 16 | path_execs=' |
18 | mountpoint openvt rsync gpg2 pinentry-curses truncate dmsetup | 17 | mountpoint openvt rsync truncate dmsetup |
19 | dmstats cryptsetup mkfs.btrfs btrfs fsck.hfsplus wait_for_files | 18 | dmstats cryptsetup mkfs.btrfs btrfs fsck.hfsplus wait_for_files |
20 | dynmenu parted fallocate strace btrfstune sfdisk | 19 | dynmenu parted fallocate strace btrfstune sfdisk |
21 | ' | 20 | ' |
@@ -23,15 +22,15 @@ path_execs=' | |||
23 | graft_paths=" | 22 | graft_paths=" |
24 | /bin/OpenVT=/bin/openvt | 23 | /bin/OpenVT=/bin/openvt |
25 | /bin/LoSetup=/sbin/losetup | 24 | /bin/LoSetup=/sbin/losetup |
26 | /patchroot/patchroot.sh=${SAMIZDAT_INITRD_PATH}/patchroot.sh | 25 | /patchroot/patchroot.sh=${OUR_BINPATH}/patchroot.sh |
27 | " | 26 | " |
28 | 27 | ||
29 | absolute_path_copies='/lib/terminfo/l/linux /usr/bin/gpg-agent' | 28 | absolute_path_copies='/lib/terminfo/l/linux' |
30 | 29 | ||
31 | modules='loop dm-snapshot dm-crypt btrfs hfs hfsplus' | 30 | modules='loop dm-snapshot dm-crypt btrfs hfs hfsplus' |
32 | modules_dirs='kernel/drivers/net/ethernet kernel/fs/nls kernel/crypto' | 31 | modules_dirs='kernel/drivers/net/ethernet kernel/fs/nls kernel/crypto' |
33 | 32 | ||
34 | for f in $repo_execs; do CopyExec "$f" /bin; done | 33 | for f in "${OUR_BINPATH}"/*; do CopyExec "$f" /bin; done |
35 | for c in $path_execs; do | 34 | for c in $path_execs; do |
36 | s=$(which $c) | 35 | s=$(which $c) |
37 | CopyExecE "$c" "$s" /bin; | 36 | CopyExecE "$c" "$s" /bin; |