File: zfs.in

package info (click to toggle)
zfs-linux 2.3.4~git20250812.3b64a96-1
  • links: PTS, VCS
  • area: contrib
  • in suites: experimental
  • size: 70,688 kB
  • sloc: ansic: 393,668; sh: 68,068; asm: 47,734; python: 8,160; makefile: 5,125; perl: 859; sed: 41
file content (59 lines) | stat: -rwxr-xr-x 1,594 bytes parent folder | download | duplicates (5)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/sh
#
# Add OpenZFS filesystem capabilities to an initrd, usually for a native ZFS root.
#

if [ "$1" = "prereqs" ]; then
	echo "udev"
	exit
fi

. /usr/share/initramfs-tools/hook-functions

for req in "@sbindir@/zpool" "@sbindir@/zfs" "@mounthelperdir@/mount.zfs"; do
	copy_exec "$req" || {
		echo "$req not available!" >&2
		exit 2
	}
done

copy_exec "@udevdir@/vdev_id"
copy_exec "@udevdir@/zvol_id"
if command -v systemd-ask-password > /dev/null; then
	copy_exec "$(command -v systemd-ask-password)"
fi

# We use pthreads, but i-t from buster doesn't automatically
# copy this indirect dependency: this can be removed when buster finally dies.
find /lib/ -type f -name "libgcc_s.so.[1-9]" | while read -r libgcc; do
	copy_exec "$libgcc"
done

# shellcheck disable=SC2050
if [ @LIBFETCH_DYNAMIC@ -gt 0 ]; then
	find /lib/ -name "@LIBFETCH_SONAME@" | while read -r libfetch; do
		copy_exec "$libfetch"
	done
fi

copy_file config "/etc/hostid"
copy_file cache  "@sysconfdir@/zfs/zpool.cache"
copy_file config "@initconfdir@/zfs"
copy_file config "@sysconfdir@/zfs/zfs-functions"
copy_file config "@sysconfdir@/zfs/vdev_id.conf"
for f in "@sysconfdir@/zfs/initramfs-tools-load-key" "@sysconfdir@/zfs/initramfs-tools-load-key.d/"*; do
	copy_file config "$f"
done
copy_file rule   "@udevruledir@/60-zvol.rules"
copy_file rule   "@udevruledir@/69-vdev.rules"

manual_add_modules zfs

if [ -f "/etc/hostname" ]; then
	copy_file config "/etc/hostname"
else
	hostname="$(mktemp -t hostname.XXXXXXXXXX)"
	hostname > "$hostname"
	copy_file config "$hostname" "/etc/hostname"
	rm -f "$hostname"
fi