aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/initramfs/hooks
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/initramfs/hooks')
-rw-r--r--contrib/initramfs/hooks/.gitignore1
-rw-r--r--contrib/initramfs/hooks/Makefile.am20
-rwxr-xr-xcontrib/initramfs/hooks/zfs.in (renamed from contrib/initramfs/hooks/zfs)18
3 files changed, 32 insertions, 7 deletions
diff --git a/contrib/initramfs/hooks/.gitignore b/contrib/initramfs/hooks/.gitignore
new file mode 100644
index 000000000..73304bc2c
--- /dev/null
+++ b/contrib/initramfs/hooks/.gitignore
@@ -0,0 +1 @@
+zfs
diff --git a/contrib/initramfs/hooks/Makefile.am b/contrib/initramfs/hooks/Makefile.am
new file mode 100644
index 000000000..0c42643f5
--- /dev/null
+++ b/contrib/initramfs/hooks/Makefile.am
@@ -0,0 +1,20 @@
+hooksdir = $(datarootdir)/initramfs-tools/hooks
+
+hooks_SCRIPTS = \
+ zfs
+
+EXTRA_DIST = \
+ $(top_srcdir)/contrib/initramfs/hooks/zfs.in
+
+$(hooks_SCRIPTS):%:%.in
+ -$(SED) -e 's,@sbindir\@,$(sbindir),g' \
+ -e 's,@sysconfdir\@,$(sysconfdir),g' \
+ -e 's,@udevdir\@,$(udevdir),g' \
+ -e 's,@udevruledir\@,$(udevruledir),g' \
+ $< >'$@'
+
+clean-local::
+ -$(RM) $(hooks_SCRIPTS)
+
+distclean-local::
+ -$(RM) $(hooks_SCRIPTS)
diff --git a/contrib/initramfs/hooks/zfs b/contrib/initramfs/hooks/zfs.in
index 26aaa6e18..ef3ccbc18 100755
--- a/contrib/initramfs/hooks/zfs
+++ b/contrib/initramfs/hooks/zfs.in
@@ -8,14 +8,18 @@ PREREQ="zdev"
# These prerequisites are provided by the zfsutils package. The zdb utility is
# not strictly required, but it can be useful at the initramfs recovery prompt.
-COPY_EXEC_LIST="/sbin/zdb /sbin/zpool /sbin/zfs /sbin/mount.zfs"
-COPY_EXEC_LIST="$COPY_EXEC_LIST /usr/bin/dirname /lib/udev/vdev_id"
-COPY_FILE_LIST="/etc/hostid /etc/zfs/zpool.cache /etc/default/zfs"
-COPY_FILE_LIST="$COPY_FILE_LIST /etc/zfs/zfs-functions /etc/zfs/vdev_id.conf"
-COPY_FILE_LIST="$COPY_FILE_LIST /lib/udev/rules.d/69-vdev.rules"
+# The mount helper mount.zfs must be installed in /sbin because this path is
+# hardcoded in the mount(8) for security reasons.
+COPY_EXEC_LIST="@sbindir@/zdb @sbindir@/zpool @sbindir@/zfs /sbin/mount.zfs"
+COPY_EXEC_LIST="$COPY_EXEC_LIST @udevdir@/vdev_id"
+COPY_FILE_LIST="/etc/hostid @sysconfdir@/zfs/zpool.cache"
+COPY_FILE_LIST="$COPY_FILE_LIST @sysconfdir@/default/zfs"
+COPY_FILE_LIST="$COPY_FILE_LIST @sysconfdir@/zfs/zfs-functions"
+COPY_FILE_LIST="$COPY_FILE_LIST @sysconfdir@/zfs/vdev_id.conf"
+COPY_FILE_LIST="$COPY_FILE_LIST @udevruledir@/69-vdev.rules"
# These prerequisites are provided by the base system.
-COPY_EXEC_LIST="$COPY_EXEC_LIST /bin/hostname /sbin/blkid"
+COPY_EXEC_LIST="$COPY_EXEC_LIST /usr/bin/dirname /bin/hostname /sbin/blkid"
# Explicitly specify all kernel modules because automatic dependency resolution
# is unreliable on many systems.
@@ -82,7 +86,7 @@ else
fi
for ii in zfs zfs.conf spl spl.conf
-do
+do
if [ -f "/etc/modprobe.d/$ii" ]; then
if [ ! -d "$DESTDIR/etc/modprobe.d" ]; then
mkdir -p $DESTDIR/etc/modprobe.d