diff options
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | contrib/initramfs/Makefile.am | 5 | ||||
-rw-r--r-- | contrib/initramfs/hooks/.gitignore | 1 | ||||
-rw-r--r-- | contrib/initramfs/hooks/Makefile.am | 20 | ||||
-rwxr-xr-x | contrib/initramfs/hooks/zfs.in (renamed from contrib/initramfs/hooks/zfs) | 18 | ||||
-rw-r--r-- | contrib/initramfs/scripts/.gitignore | 1 | ||||
-rw-r--r-- | contrib/initramfs/scripts/Makefile.am | 20 | ||||
-rw-r--r-- | contrib/initramfs/scripts/local-top/Makefile.am | 3 | ||||
-rw-r--r-- | contrib/initramfs/scripts/zfs.in (renamed from contrib/initramfs/scripts/zfs) | 8 |
9 files changed, 65 insertions, 14 deletions
diff --git a/configure.ac b/configure.ac index 6d1de13f9..47e0a1b12 100644 --- a/configure.ac +++ b/configure.ac @@ -122,6 +122,9 @@ AC_CONFIG_FILES([ contrib/dracut/02zfsexpandknowledge/Makefile contrib/dracut/90zfs/Makefile contrib/initramfs/Makefile + contrib/initramfs/hooks/Makefile + contrib/initramfs/scripts/Makefile + contrib/initramfs/scripts/local-top/Makefile module/Makefile module/avl/Makefile module/nvpair/Makefile diff --git a/contrib/initramfs/Makefile.am b/contrib/initramfs/Makefile.am index 998e588ab..b1ab0c951 100644 --- a/contrib/initramfs/Makefile.am +++ b/contrib/initramfs/Makefile.am @@ -2,11 +2,10 @@ initrddir = $(datarootdir)/initramfs-tools initrd_SCRIPTS = conf-hooks.d/zfs hooks/zfs scripts/zfs scripts/local-top/zfs +SUBDIRS = hooks scripts + EXTRA_DIST = \ $(top_srcdir)/contrib/initramfs/conf-hooks.d/zfs \ - $(top_srcdir)/contrib/initramfs/hooks/zfs \ - $(top_srcdir)/contrib/initramfs/scripts/zfs \ - $(top_srcdir)/contrib/initramfs/scripts/local-top/zfs \ $(top_srcdir)/contrib/initramfs/README.initramfs.markdown install-initrdSCRIPTS: $(EXTRA_DIST) 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 diff --git a/contrib/initramfs/scripts/.gitignore b/contrib/initramfs/scripts/.gitignore new file mode 100644 index 000000000..73304bc2c --- /dev/null +++ b/contrib/initramfs/scripts/.gitignore @@ -0,0 +1 @@ +zfs diff --git a/contrib/initramfs/scripts/Makefile.am b/contrib/initramfs/scripts/Makefile.am new file mode 100644 index 000000000..7b65429fd --- /dev/null +++ b/contrib/initramfs/scripts/Makefile.am @@ -0,0 +1,20 @@ +scriptsdir = $(datarootdir)/initramfs-tools/scripts + +scripts_SCRIPTS = \ + zfs + +SUBDIRS = local-top + +EXTRA_DIST = \ + $(top_srcdir)/contrib/initramfs/scripts/zfs.in + +$(scripts_SCRIPTS):%:%.in + -$(SED) -e 's,@sbindir\@,$(sbindir),g' \ + -e 's,@sysconfdir\@,$(sysconfdir),g' \ + $< >'$@' + +clean-local:: + -$(RM) $(scripts_SCRIPTS) + +distclean-local:: + -$(RM) $(scripts_SCRIPTS) diff --git a/contrib/initramfs/scripts/local-top/Makefile.am b/contrib/initramfs/scripts/local-top/Makefile.am new file mode 100644 index 000000000..88aa2d4ff --- /dev/null +++ b/contrib/initramfs/scripts/local-top/Makefile.am @@ -0,0 +1,3 @@ +localtopdir = $(datarootdir)/initramfs-tools/scripts/local-top + +EXTRA_DIST = zfs diff --git a/contrib/initramfs/scripts/zfs b/contrib/initramfs/scripts/zfs.in index 500ae3fc8..3d3aa537d 100644 --- a/contrib/initramfs/scripts/zfs +++ b/contrib/initramfs/scripts/zfs.in @@ -11,9 +11,9 @@ # Paths to what we need - in the initrd, these paths are hardcoded, # so override the defines in zfs-functions. -ZFS="/sbin/zfs" -ZPOOL="/sbin/zpool" -ZPOOL_CACHE="/etc/zfs/zpool.cache" +ZFS="@sbindir@/zfs" +ZPOOL="@sbindir@/zpool" +ZPOOL_CACHE="@sysconfdir@/zfs/zpool.cache" export ZFS ZPOOL ZPOOL_CACHE # This runs any scripts that should run before we start importing @@ -610,7 +610,7 @@ setup_snapshot_booting() # Separate the full snapshot ('$snap') into it's filesystem and # snapshot names. Would have been nice with a split() function.. rootfs="${snap%%@*}" - snapname="${snap##*@}" + snapname="${snap##*@}" ZFS_BOOTFS="${rootfs}_${snapname}" if ! grep -qiE '(^|[^\\](\\\\)* )(rollback)=(on|yes|1)( |$)' /proc/cmdline |