[Pkg-zfsonlinux-devel] [SCM] zfs branch, master, updated. upstream/0.6.4.2-632-g937bf5a
Aron Xu
aron at debian.org
Sun Nov 1 15:13:20 UTC 2015
The following commit has been merged in the master branch:
commit 56eda9c6ee37a0a470bbaca1c1312fb974770333
Author: Aron Xu <aron at debian.org>
Date: Sun Nov 1 22:31:59 2015 +0800
Use upstream version of initramfs configurations
diff --git a/debian/tree/zfs-initramfs/usr/share/initramfs-tools/conf-hooks.d/zfs b/debian/tree/zfs-initramfs/usr/share/initramfs-tools/conf-hooks.d/zfs
deleted file mode 100644
index 29950ca..0000000
--- a/debian/tree/zfs-initramfs/usr/share/initramfs-tools/conf-hooks.d/zfs
+++ /dev/null
@@ -1,2 +0,0 @@
-# Force the inclusion of Busybox in the initramfs.
-BUSYBOX=y
diff --git a/debian/tree/zfs-initramfs/usr/share/initramfs-tools/hooks/zfs b/debian/tree/zfs-initramfs/usr/share/initramfs-tools/hooks/zfs
deleted file mode 100755
index b8bb41e..0000000
--- a/debian/tree/zfs-initramfs/usr/share/initramfs-tools/hooks/zfs
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/bin/sh
-#
-# Add ZoL filesystem capabilities to an initrd, usually for a native ZFS root.
-#
-
-# This hook installs udev rules for ZoL.
-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"
-
-# These prerequisites are provided by the base system.
-COPY_EXEC_LIST="$COPY_EXEC_LIST /bin/hostname /sbin/blkid"
-
-# Explicitly specify all kernel modules because automatic dependency resolution
-# is unreliable on many systems.
-BASE_MODULES="zlib_deflate spl zavl zcommon znvpair zunicode zfs"
-CRPT_MODULES="sun-ccm sun-gcm sun-ctr"
-MANUAL_ADD_MODULES_LIST="$BASE_MODULES"
-
-# Generic result code.
-RC=0
-
-case $1 in
-prereqs)
- echo "$PREREQ"
- exit 0
- ;;
-esac
-
-for ii in $COPY_EXEC_LIST
-do
- if [ ! -x "$ii" ]
- then
- echo "Error: $ii is not executable."
- RC=2
- fi
-done
-
-if [ "$RC" -ne 0 ]
-then
- exit "$RC"
-fi
-
-. /usr/share/initramfs-tools/hook-functions
-
-mkdir -p "$DESTDIR/etc/"
-
-# ZDB uses pthreads for some functions, but the library dependency is not
-# automatically detected. The `find` utility and extended `cp` options are
-# used here because libgcc_s.so could be in a subdirectory of /lib for
-# multi-arch installations.
-cp --target-directory="$DESTDIR" --parents $(find /lib -type f -name libgcc_s.so.1)
-
-for ii in $COPY_EXEC_LIST
-do
- copy_exec "$ii"
-done
-
-for ii in $MANUAL_ADD_MODULES_LIST
-do
- manual_add_modules "$ii"
-done
-
-if [ -f "/etc/hostname" ]
-then
- cp -p "/etc/hostname" "$DESTDIR/etc/"
-else
- hostname >"$DESTDIR/etc/hostname"
-fi
-
-# The spl-dkms package ensures that the /etc/hostid file exists.
-# NB: Commentary in the spl-dkms.postinst script.
-[ -f "/etc/hostid" ] && cp -p "/etc/hostid" "$DESTDIR/etc/hostid"
-
-# Install the zpool.cache file.
-[ ! -d "$DESTDIR/boot/zfs" ] && mkdir -p "$DESTDIR/boot/zfs"
-[ -d /boot/zfs ] && cp -r /boot/zfs "$DESTDIR/boot"
-exit 0
diff --git a/debian/tree/zfs-initramfs/usr/share/initramfs-tools/scripts/zfs b/debian/tree/zfs-initramfs/usr/share/initramfs-tools/scripts/zfs
deleted file mode 100644
index de3bad6..0000000
--- a/debian/tree/zfs-initramfs/usr/share/initramfs-tools/scripts/zfs
+++ /dev/null
@@ -1,236 +0,0 @@
-# ZFS boot stub for initramfs-tools.
-#
-# In the initramfs environment, the /init script sources this stub to
-# override the default functions in the /scripts/local script.
-#
-# Enable this by passing boot=zfs on the kernel command line.
-#
-
-
-pre_mountroot()
-{
- [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-top"
- run_scripts /scripts/local-top
- [ "$quiet" != "y" ] && log_end_msg
-
- if [ -r '/etc/default/zfs' ]
- then
- . '/etc/default/zfs'
- if [ "$ZFS_INITRD_PRE_MOUNTROOT_SLEEP" -gt '0' ]
- then
- [ "$quiet" != "y" ] && log_begin_msg "Sleeping for $ZFS_INITRD_PRE_MOUNTROOT_SLEEP seconds..."
- sleep "$ZFS_INITRD_PRE_MOUNTROOT_SLEEP"
- [ "$quiet" != "y" ] && log_end_msg
- fi
- fi
-}
-
-# Duplicates the functionality found under try_failure_hooks in functions
-# but invoking that would be inappropriate here.
-disable_plymouth()
-{
- if [ -x /bin/plymouth ] && /bin/plymouth --ping
- then
- /bin/plymouth hide-splash >/dev/null 2>&1
- fi
-}
-
-mountroot()
-{
- pre_mountroot
-
- [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-premount"
- run_scripts /scripts/local-premount
- [ "$quiet" != "y" ] && log_end_msg
-
- # Wait for all of the /dev/{hd,sd}[a-z] device nodes to appear.
- wait_for_udev
-
- # Load the module now to get consistent automatic pool import behavior.
- modprobe zfs
-
- # Check the kernel command line for overrides.
- ZFS_RPOOL="${rpool#rpool=}"
- ZFS_BOOTFS="${bootfs#bootfs=}"
-
- if [ -z "$ZFS_RPOOL" ]
- then
- # Check for the `-B zfs-bootfs=%s/%u,...` kind of parameter.
- #
- # The ${zfs-bootfs} variable is set at the kernel commmand
- # line, usually by GRUB, but it cannot be referenced here
- # directly because bourne variable names cannot contain a
- # hyphen.
- #
- # Reassign the variable by dumping the environment and
- # stripping the zfs-bootfs= prefix. Let the shell handle
- # quoting through the eval command.
- eval ZFS_RPOOL=$(set | sed -n -e 's,^zfs-bootfs=,,p')
-
- # Only the pool name is relevant because the ZFS filesystem on
- # Linux is extrinsic and the userland cannot resolve a ZFS
- # object number.
- #
- # Strip everything after the first slash character.
- ZFS_RPOOL=$(echo "$ZFS_RPOOL" | sed -e 's,/.*,,')
- fi
-
- # Use "rpool" as the default, like on most Solaris systems.
- [ -z "$ZFS_RPOOL" ] && ZFS_RPOOL='rpool'
-
- if [ -f /etc/zfs/zpool.cache ]; then
- ZPOOL_CACHE=/etc/zfs/zpool.cache
- elif [ -f /boot/zfs/zpool.cache ]; then
- ZPOOL_CACHE=/boot/zfs/zpool.cache
- fi
-
- # zpool import refuse to import without a valid mtab
- [ ! -f /proc/mounts ] && mount proc /proc
- [ ! -f /etc/mtab ] && cat /proc/mounts > /etc/mtab
-
- # Just make sure it's not already imported. Should be impossible, but...
- zpool list "$ZFS_RPOOL" 1>/dev/null 2>&1
- ZFS_ERROR=$?
-
- [ "$quiet" != "y" ] && log_begin_msg "Importing ZFS root pool $ZFS_RPOOL"
- # Attempt 1: Try the correct/proper way.
- if [ "$ZFS_ERROR" -ne 0 -a -n "$ZPOOL_CACHE" ]
- then
- ZFS_CMD="zpool import -c $ZPOOL_CACHE -N $ZFS_RPOOL"
-
- ZFS_STDERR=$($ZFS_CMD 2>&1)
- ZFS_ERROR=$?
-
- [ "$ZFS_ERROR" -ne 0 ] && echo "FAIL: $ZFS_CMD. Retrying..."
- fi
-
- # Attempt 2: Try forcing the import, using /dev/disk/by-id if it exists.
- [ -d /dev/disk/by-id ] && DISK_BY_ID="-d /dev/disk/by-id"
- if [ "$ZFS_ERROR" -ne 0 -o -z "$ZPOOL_CACHE" ]
- then
- ZFS_CMD="zpool import -f -N $DISK_BY_ID $ZFS_RPOOL"
-
- ZFS_STDERR=$($ZFS_CMD 2>&1)
- ZFS_ERROR=$?
-
- [ "$ZFS_ERROR" -ne 0 ] && echo "FAIL: $ZFS_CMD. Retrying..."
- fi
-
- # Attempt 3: Last ditch attempt. If DISK_BY_ID is set, we've already tried...
- if [ "$ZFS_ERROR" -ne 0 -a -z "$DISK_BY_ID" ]
- then
- ZFS_CMD="zpool import -f -N $ZFS_RPOOL"
-
- ZFS_STDERR=$($ZFS_CMD 2>&1)
- ZFS_ERROR=$?
-
- [ "$ZFS_ERROR" -ne 0 ] && echo "FAIL: $ZFS_CMD. Retrying..."
- fi
- [ "$quiet" != "y" ] && log_end_msg
-
- if [ "$ZFS_ERROR" -ne 0 ]
- then
- disable_plymouth
- echo "Command: $ZFS_CMD"
- echo "Message: $ZFS_STDERR"
- echo "Error: $ZFS_ERROR"
- echo ""
- echo "Manually import the root pool at the command prompt and then exit."
- echo "Hint: Try: zpool import -f -R / -N $ZFS_RPOOL"
- /bin/sh
- fi
-
- if [ -z "$ZFS_BOOTFS" ]
- then
- [ "$quiet" != "y" ] && log_begin_msg "Getting ZFS bootfs property"
- ZFS_BOOTFS=$(zpool list -H -o bootfs "$ZFS_RPOOL")
- ZFS_ERROR=$?
- [ "$quiet" != "y" ] && log_end_msg
- fi
-
- if [ -z "$ZFS_BOOTFS" ]
- then
- disable_plymouth
- echo "Command: zpool list -H -o bootfs $ZFS_RPOOL"
- echo "Error: $ZFS_ERROR, unable to get the bootfs property."
- echo ""
- echo "Manually mount the root filesystem on $rootmnt and then exit."
- echo "Hint: Try: mount -t zfs -o zfsutil $ZFS_RPOOL/ROOT/system $rootmnt"
- /bin/sh
- fi
-
- # Force the mountpoint to the only correct value for a root filesystem.
- [ "$quiet" != "y" ] && log_begin_msg "Setting mountpoint=/ on ZFS filesystem $ZFS_BOOTFS"
- ZFS_STDERR=$(zfs set mountpoint=/ "$ZFS_BOOTFS" 2>&1)
- [ "$quiet" != "y" ] && log_end_msg
-
- if zfs 2>&1 | grep -q 'key -l '
- then
- # 'zfs key' is availible (hence we have crypto), check if filesystem is encrypted.
- set -- `zfs get encryption $ZFS_BOOTFS | grep ^$ZFS_RPOOL`
- crypt_type=$3
- if [ "$crypt_type" != "off" ]
- then
- [ "$quiet" != "y" ] && log_begin_msg "Loading crypto wrapper key for $ZFS_BOOTFS"
-
- # Just make sure that ALL crypto modules module is loaded.
- # Simplest just to load all...
- for mod in sun-ccm sun-gcm sun-ctr
- do
- modprobe $mod
- done
-
- # If the key isn't availible, then this will fail!
- ZFS_CMD="zfs key -l -a"
- ZFS_STDERR=$($ZFS_CMD 2>&1)
- ZFS_ERROR=$?
-
- if [ "$ZFS_ERROR" -ne 0 ]
- then
- disable_plymouth
- echo "FAIL: $ZFS_CMD"
- echo "Message: $ZFS_STDERR"
- echo "Error: $ZFS_ERROR"
- echo ""
- echo "Failed to load zfs encryption wrapper key (s)."
- echo "Please verify dataset property 'keysource' for datasets"
- echo "and rerun: $ZFS_CMD"
- /bin/sh
-
- ZFS_ERROR=0
- else
- [ "$quiet" != "y" ] && log_end_msg
- fi
- fi
- fi
-
- # Ideally, the root filesystem would be mounted like this:
- #
- # zpool import -R "$rootmnt" -N "$ZFS_RPOOL"
- # zfs mount -o mountpoint=/ "$ZFS_BOOTFS"
- #
- # but the MOUNTPOINT prefix is preserved on descendent filesystem after
- # the pivot into the regular root, which later breaks things like
- # `zfs mount -a` and the /etc/mtab refresh.
-
- [ "$quiet" != "y" ] && log_begin_msg "Mounting ZFS filesystem $ZFS_BOOTFS"
- ZFS_STDERR=$(mount -t zfs -o zfsutil "$ZFS_BOOTFS" "$rootmnt" 2>&1)
- ZFS_ERROR=$?
- [ "$quiet" != "y" ] && log_end_msg
-
- if [ "$ZFS_ERROR" -ne 0 ]
- then
- disable_plymouth
- echo ""
- echo "Command: mount -t zfs -o zfsutil $ZFS_BOOTFS $rootmnt"
- echo "Message: $ZFS_STDERR"
- echo "Error: $ZFS_ERROR"
- echo ""
- echo "Manually mount the root filesystem on $rootmnt and then exit."
- /bin/sh
- fi
-
- [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-bottom"
- run_scripts /scripts/local-bottom
- [ "$quiet" != "y" ] && log_end_msg
-}
diff --git a/debian/zfs-initramfs.install b/debian/zfs-initramfs.install
index b853d8e..efd8c64 100644
--- a/debian/zfs-initramfs.install
+++ b/debian/zfs-initramfs.install
@@ -1 +1 @@
-../tree/zfs-initramfs/* /
+usr/share/initramfs-tools/*
--
ZFS on Linux
More information about the Pkg-zfsonlinux-devel
mailing list