From c7f98efa895d14a7bf1caa6f567050a6abcb15ce Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Sun, 1 May 2016 05:53:38 -0400 Subject: copy more executables from initrd to rootfs (if missing) --- src/initrd/btrfs-create.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/initrd/btrfs-create.sh') diff --git a/src/initrd/btrfs-create.sh b/src/initrd/btrfs-create.sh index edd2d1c..6a6a94e 100644 --- a/src/initrd/btrfs-create.sh +++ b/src/initrd/btrfs-create.sh @@ -93,6 +93,19 @@ mountpoint_of() printf '%s\n' "$f" } +copy_execs() +{ + local d b + d=$1 + shift + + for b in "$@"; do + [ -x "/root/$d/$b" ] && continue + [ "$(which "$b")" ] || continue + cp "$(which "$b")" "/root/$d/$b" + done +} + initialize_root_filesystem() { rm -r /root/root @@ -107,7 +120,9 @@ initialize_root_filesystem() rmdir /root/home btrfs subvolume create /root/home || return - [ -x /root/sbin/mdadm ] || cp /sbin/mdadm /root/sbin/ + copy_execs sbin mdadm dmsetup cryptsetup + copy_execs bin btrfs rsync gpg gpg2 gpg-agent + # Copy these over unconditionally, because they ought to remain in sync with # the initrd. cp /bin/mdadm-dup.sh /root/sbin/ -- cgit v1.2.3