]>
Commit | Line | Data |
---|---|---|
2cac7f5f TF |
1 | #!/bin/sh |
2 | # | |
1966e959 | 3 | # Add OpenZFS filesystem capabilities to an initrd, usually for a native ZFS root. |
2cac7f5f TF |
4 | # |
5 | ||
5236eafd AZ |
6 | if [ "$1" = "prereqs" ]; then |
7 | echo "udev" | |
8 | exit | |
9 | fi | |
2cac7f5f | 10 | |
5236eafd | 11 | . /usr/share/initramfs-tools/hook-functions |
2cac7f5f | 12 | |
5236eafd AZ |
13 | for req in "@sbindir@/zpool" "@sbindir@/zfs" "@mounthelperdir@/mount.zfs"; do |
14 | copy_exec "$req" || { | |
15 | echo "$req not available!" >&2 | |
16 | exit 2 | |
17 | } | |
2cac7f5f TF |
18 | done |
19 | ||
5236eafd AZ |
20 | copy_exec "@sbindir@/zdb" |
21 | copy_exec "@udevdir@/vdev_id" | |
22 | copy_exec "@udevdir@/zvol_id" | |
23 | if command -v systemd-ask-password > /dev/null; then | |
24 | copy_exec "$(command -v systemd-ask-password)" | |
2cac7f5f TF |
25 | fi |
26 | ||
5236eafd AZ |
27 | # We use pthreads, but i-t from buster doesn't automatically |
28 | # copy this indirect dependency: this can be removed when buster finally dies. | |
29 | for libgcc in $(find /lib/ -type f -name libgcc_s.so.[1-9]); do | |
30 | copy_exec "$libgcc" | |
31 | done | |
2cac7f5f | 32 | |
5236eafd AZ |
33 | if [ @LIBFETCH_DYNAMIC@ != 0 ]; then |
34 | for libfetch in $(find /lib/ -name @LIBFETCH_SONAME@); do | |
35 | copy_exec "$libfetch" | |
37086897 AZ |
36 | done |
37 | fi | |
38 | ||
5236eafd AZ |
39 | copy_file config "/etc/hostid" |
40 | copy_file cache "@sysconfdir@/zfs/zpool.cache" | |
41 | copy_file config "@initconfdir@/zfs" | |
42 | copy_file config "@sysconfdir@/zfs/zfs-functions" | |
43 | copy_file config "@sysconfdir@/zfs/vdev_id.conf" | |
44 | copy_file rule "@udevruledir@/60-zvol.rules" | |
45 | copy_file rule "@udevruledir@/69-vdev.rules" | |
2cac7f5f | 46 | |
5236eafd | 47 | manual_add_modules zfs |
2cac7f5f | 48 | |
5236eafd AZ |
49 | if [ -f "/etc/hostname" ]; then |
50 | copy_file config "/etc/hostname" | |
2cac7f5f | 51 | else |
5236eafd AZ |
52 | hostname="$(mktemp -t hostname.XXXXXXXXXX)" |
53 | hostname > "$hostname" | |
54 | copy_file config "$hostname" "/etc/hostname" | |
55 | rm -f "$hostname" | |
2cac7f5f | 56 | fi |