summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/initrd/btrfs-create.sh17
1 files changed, 16 insertions, 1 deletions
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()
93 printf '%s\n' "$f" 93 printf '%s\n' "$f"
94} 94}
95 95
96copy_execs()
97{
98 local d b
99 d=$1
100 shift
101
102 for b in "$@"; do
103 [ -x "/root/$d/$b" ] && continue
104 [ "$(which "$b")" ] || continue
105 cp "$(which "$b")" "/root/$d/$b"
106 done
107}
108
96initialize_root_filesystem() 109initialize_root_filesystem()
97{ 110{
98 rm -r /root/root 111 rm -r /root/root
@@ -107,7 +120,9 @@ initialize_root_filesystem()
107 rmdir /root/home 120 rmdir /root/home
108 btrfs subvolume create /root/home || return 121 btrfs subvolume create /root/home || return
109 122
110 [ -x /root/sbin/mdadm ] || cp /sbin/mdadm /root/sbin/ 123 copy_execs sbin mdadm dmsetup cryptsetup
124 copy_execs bin btrfs rsync gpg gpg2 gpg-agent
125
111 # Copy these over unconditionally, because they ought to remain in sync with 126 # Copy these over unconditionally, because they ought to remain in sync with
112 # the initrd. 127 # the initrd.
113 cp /bin/mdadm-dup.sh /root/sbin/ 128 cp /bin/mdadm-dup.sh /root/sbin/