diff options
author | Andrew Cady <d@jerkface.net> | 2016-04-27 20:44:01 -0400 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2016-04-27 20:44:01 -0400 |
commit | e8c2c781aea759c47bf81ff2aed5960032a5b50e (patch) | |
tree | 27e8e73e8f6ccbc4246e36829389e15b755169c8 /initramfs-tools | |
parent | 2a939f345df828b467a28f90052fd6b4ff004a9e (diff) |
slight cleanup/factor
Diffstat (limited to 'initramfs-tools')
-rwxr-xr-x | initramfs-tools/hooks/samizdat | 43 |
1 files changed, 17 insertions, 26 deletions
diff --git a/initramfs-tools/hooks/samizdat b/initramfs-tools/hooks/samizdat index 5b1971b..ac71947 100755 --- a/initramfs-tools/hooks/samizdat +++ b/initramfs-tools/hooks/samizdat | |||
@@ -1,55 +1,46 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | # TODO: check samizdat source to see what it copies | ||
2 | [ "$1" = prereqs ] && { echo; exit; } | 3 | [ "$1" = prereqs ] && { echo; exit; } |
3 | 4 | ||
4 | CopyExec() { copy_exec "$@" || exit 1; } | 5 | CopyExec() { copy_exec "$@" || exit 1; } |
5 | 6 | ||
6 | . /usr/share/initramfs-tools/hook-functions | 7 | . /usr/share/initramfs-tools/hook-functions |
7 | 8 | ||
8 | for f in ./old-school/* loop-layer.sh; do CopyExec "$f" /bin; done | 9 | repo_execs=$(echo ./old-school/* loop-layer.sh) |
9 | 10 | ||
10 | # TODO: check samizdat source to see what it copies | ||
11 | path_execs='mountpoint openvt rsync gpg2 gpg-agent pinentry-curses truncate cryptsetup mkfs.btrfs btrfs fsck.hfsplus' | 11 | path_execs='mountpoint openvt rsync gpg2 gpg-agent pinentry-curses truncate cryptsetup mkfs.btrfs btrfs fsck.hfsplus' |
12 | 12 | ||
13 | for c in $path_execs; do CopyExec "$(which $c)" /bin; done | ||
14 | |||
15 | graft_paths=" | 13 | graft_paths=" |
16 | /bin/OpenVT=/bin/openvt | 14 | /bin/OpenVT=/bin/openvt |
17 | /bin/LoSetup=/sbin/losetup | 15 | /bin/LoSetup=/sbin/losetup |
18 | /patchroot/patchroot.sh=patchroot.sh | 16 | /patchroot/patchroot.sh=patchroot.sh |
19 | /patchroot/sources.list=/etc/apt/sources.list | 17 | /patchroot/sources.list=/etc/apt/sources.list |
20 | /patchroot/initrd-dependencies.txt=initrd-dependencies.txt | 18 | /patchroot/initrd-dependencies.txt=initrd-dependencies.txt |
19 | /lib/samizdat/vol_id.txt=vol_id.txt | ||
21 | " | 20 | " |
22 | 21 | ||
23 | for e in $graft_paths; do | ||
24 | case "$e" in | ||
25 | *=*) | ||
26 | dest=${e%%=*} | ||
27 | src=${e#*=} | ||
28 | CopyExec "$src" "$dest" | ||
29 | ;; | ||
30 | *) exit 1 ;; | ||
31 | esac | ||
32 | done | ||
33 | |||
34 | absolute_path_copies='/lib/terminfo/l/linux' | 22 | absolute_path_copies='/lib/terminfo/l/linux' |
35 | 23 | ||
36 | for f in $absolute_path_copies; do CopyExec "$f" "$f"; done | ||
37 | |||
38 | samizdat_execs_dir=/home/d/src/samizdat # TODO | ||
39 | samizdat_execs='wait_for_files samizdat-pinentry dynmenu src/samizdat-password-agent src/samizdat-gpg-agent' | 24 | samizdat_execs='wait_for_files samizdat-pinentry dynmenu src/samizdat-password-agent src/samizdat-gpg-agent' |
25 | modules='loop xts dm-crypt hfs hfsplus' | ||
26 | modules_dirs='kernel/drivers/net/ethernet kernel/fs/nls' | ||
40 | 27 | ||
41 | for c in $samizdat_execs; do CopyExec ${samizdat_execs_dir}/$c /bin; done | ||
42 | 28 | ||
43 | CopyExec vol_id.txt /lib/samizdat/vol_id.txt | ||
44 | 29 | ||
45 | modules='loop xts dm-crypt hfs hfsplus' | ||
46 | for m in $modules; do force_load "$m" || exit 1; done | ||
47 | 30 | ||
48 | sex() { (set -x; "$@"); } | 31 | for f in $repo_execs; do CopyExec "$f" /bin; done |
32 | for c in $path_execs; do CopyExec "$(which $c)" /bin; done | ||
33 | for f in $absolute_path_copies; do CopyExec "$f" "$f"; done | ||
34 | samizdat_execs_dir=/home/d/src/samizdat # TODO | ||
35 | for c in $samizdat_execs; do CopyExec ${samizdat_execs_dir}/$c /bin; done | ||
36 | for m in $modules; do force_load "$m" || exit 1; done | ||
37 | for dir in $modules_dirs; do copy_modules_dir "$dir" || exit 1; done | ||
49 | 38 | ||
50 | modules_dirs='kernel/drivers/net/ethernet kernel/fs/nls' | 39 | for e in $graft_paths; do |
51 | for dir in $modules_dirs; do | 40 | case "$e" in |
52 | copy_modules_dir "$dir" || exit 1 | 41 | *=*) CopyExec "${e#*=}" "${e%%=*}" ;; |
42 | *) exit 1 ;; | ||
43 | esac | ||
53 | done | 44 | done |
54 | 45 | ||
55 | exit 0 | 46 | exit 0 |