summaryrefslogtreecommitdiff
path: root/initramfs-tools/hooks/samizdat
blob: 9b8a335463fbf41cc02add31ec507aa1e0c59342 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/sh
# TODO: check samizdat source to see what it copies
[ "$1" = prereqs ] && { echo; exit; }

CopyExec() { copy_exec "$@" || exit 1; }

. /usr/share/initramfs-tools/hook-functions
PATH=/usr/local/bin:$PATH
. samizdat-paths.sh

repo_execs=$(echo "${samizdat_initrd_files_dir}"/*)

path_execs='mountpoint openvt rsync gpg2 gpg-agent pinentry-curses truncate cryptsetup mkfs.btrfs btrfs fsck.hfsplus wait_for_files samizdat-pinentry dynmenu samizdat-password-agent samizdat-gpg-agent parted'

graft_paths="
    /bin/OpenVT=/bin/openvt
    /bin/LoSetup=/sbin/losetup
    /patchroot/patchroot.sh=${samizdat_initrd_files_dir}/patchroot.sh
    /patchroot/sources.list=/etc/apt/sources.list
    /patchroot/initrd-dependencies.txt=${samizdat_initrd_files_dir}/initrd-dependencies.txt
    /lib/samizdat/vol_id.txt=${samizdat_initrd_files_dir}/vol_id.txt
"

absolute_path_copies='/lib/terminfo/l/linux'

modules='loop xts dm-crypt hfs hfsplus'
modules_dirs='kernel/drivers/net/ethernet kernel/fs/nls'




for f in $repo_execs; do CopyExec "$f" /bin; done
for c in $path_execs; do CopyExec "$(which $c)" /bin; done
for f in $absolute_path_copies; do CopyExec "$f" "$f"; done
for m in $modules; do force_load "$m" || exit 1; done
for dir in $modules_dirs; do copy_modules_dir "$dir" || exit 1; done

for e in $graft_paths; do
    case "$e" in
        *=*) CopyExec "${e#*=}" "${e%%=*}" ;;
        *) exit 1 ;;
    esac
done

exit 0