forked from openzfs/zfs
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Put in /usr/share/initramfs-tools/ or /etc/initramfs-tools/. * With pull request openzfs#1476 (not yet merged) comes a verbose warning if /usr/bin/net doesn't exist or isn't executable. Just create a dummy... * If user haven't specified pool, but bootfs then use the first part of the bootfs path as pool name. * Add support for booting of a ZFS snapshot. Do this by cloning the snapshot into a dataset. If this the resulting dataset already exists, destroy it. Then set mountpoint=/ on that dataset and mount it on root. + If snapshot does not exist, use base dataset (the part before '@') as boot filesystem instead. * Add support for more kernel command line arguments (ideas taken from the Fedora/Redhat dracut script): + (zfs_force|zfs.force|zfsforce)=(on|yes|1) (ignore case). + root=zfs:AUTO => try to find rootfs automatically. + root=zfs:<dataset> + root=ZFS=<dataset> * Remove the existing '-f' option to 'zpool import', instead let this be controlled on the kernel command line. * Do not force-set mountpoint=/ - should (??) not be nessesary. * Support mounting a rootfs with mountpoint=legacy * Support both RPM based and DEB based system by removing the logic from the dracut script and instead use the logic in scripts/zfs-initramfs/scripts/zfs for both Debian GNU/Linux (etc) and RedHat/Fedora (etc). * Only run the local-* script(s) if/when it/they exists. * Don't auto import pools when loading module - keep better control of the imports. * If called with only 'rpool' (or only 'zfs-bootfs'), then fake it by setting 'root=zfs:AUTO' (to avoid duplication of code etc) so that it will be auto detected later. + If pool is specified and we're auto discovering, don't go through ALL pools, only the one we specified. * Rewrite the auto detection of bootfs in the auto detector. * Only try to import pool if it haven't already been imported (in the auto detector). * Add support for only having 'root=pool/dataset' option. * Remove the use of setting 'ZFS_RPOOL=rpool'. No longer nessesary. * Check if /scripts/local-* is either file or directory - should be dir, but just to be safe check both. * Make wait_for_udev wait for 10 seconds. * Add a configurable ZFS_INITRD_POST_MODPROBE_SLEEP (set in /etc/default/zfs) after the modprobe. * Merge openzfs#2196. Remove lines that contain only a hyphen (match '^-$' instead of '-'). * Add a 'default' file to go in '/etc/default/zfs'. * Support mounting additional filesystems (such as /var and /usr etc) in the initrd using ZFS_INITRD_ADDITIONAL_DATASETS set in /etc/defaults/zfs. * Add exceptions to pool imports. + Both for init and initrd script. * Make sure that the zpool.cache file is actually copied onto the initrd!! * Include /etc/modprobe.d/{zfs,spl}.conf in the initrd if they exist. * Export all pools found after the modprobe - zfs_autoimport_disable=1' don't seem to be working in >= 0.6.3. + This snippet will go away as soon as I can figure out why it doesn't, it's ugly!! * Only try /dev/disk/by-* in the initrd if USE_DISK_BY_ID is set. + Try this first, then fallback to using the cache file if that exist.
- Loading branch information
Showing
7 changed files
with
776 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Force the inclusion of Busybox in the initramfs. | ||
BUSYBOX=y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# ZoL userland configuration. | ||
|
||
# Run `zfs mount -a` during system start? | ||
# This should be 'no' if zfs-mountall or a systemd generator | ||
# is available. | ||
ZFS_MOUNT='yes' | ||
|
||
# Run `zfs unmount -a` during system stop? | ||
# This should be 'no' on most systems. | ||
ZFS_UNMOUNT='yes' | ||
|
||
# Run `zfs share -a` during system start? | ||
# nb: The shareiscsi, sharenfs, and sharesmb dataset properties. | ||
ZFS_SHARE='yes' | ||
|
||
# Run `zfs unshare -a` during system stop? | ||
ZFS_UNSHARE='yes' | ||
|
||
# Sould we use '-d /dev/disk/by-*' when importing pool. | ||
# This is recomended, but the default 'no' uses the cache | ||
# file. | ||
# Variable is somewhat missleading. Previously the code | ||
# tried _only_ '/dev/disk/by-id', but will now try any | ||
# '/dev/disk/by-*' directory. | ||
USE_DISK_BY_ID='yes' | ||
|
||
# Should the datasets be mounted verbosly (a mount counter | ||
# will be used when mounting if set to 'yes'). | ||
VERBOSE_MOUNT='no' | ||
|
||
# Should we allow overlay mounts (this is standard in Linux, | ||
# but not ZFS which comes from Solaris where this is not allowed). | ||
DO_OVERLAY_MOUNTS='no' | ||
|
||
# Any additional option to the 'zfs mount' command line. | ||
# Include '-o' for each option wanted. | ||
MOUNT_EXTRA_OPTIONS="" | ||
|
||
# Build kernel modules with the --enable-debug switch? | ||
ZFS_DKMS_ENABLE_DEBUG='no' | ||
|
||
# Build kernel modules with the --enable-debug-dmu-tx switch? | ||
ZFS_DKMS_ENABLE_DEBUG_DMU_TX='no' | ||
|
||
# Keep debugging symbols in kernel modules? | ||
ZFS_DKMS_DISABLE_STRIP='no' | ||
|
||
# Wait for this many seconds in the initrd pre_mountroot? | ||
# This delays startup and should be '0' on most systems. | ||
ZFS_INITRD_PRE_MOUNTROOT_SLEEP='0' | ||
|
||
# Wait for this many seconds in the initrd mountroot? | ||
# This delays startup and should be '0' on most systems. | ||
# This might help on systems which have their ZFS root on | ||
# a USB disk that takes just a little longer to be available | ||
ZFS_INITRD_POST_MODPROBE_SLEEP='0' | ||
|
||
# List of additional datasets to mount after the root | ||
# dataset is mounted. | ||
# The init script will use the mountpoint specified in | ||
# the 'mountpoint' property value in the dataset to | ||
# determine where it should be mounted. | ||
#ZFS_INITRD_ADDITIONAL_DATASETS="rpool/ROOT/usr_local" | ||
|
||
# Location of the lockfile. | ||
LOCKDIR=/run/lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
#!/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 | ||
|
||
for ii in zfs zfs.conf spl spl.conf | ||
do | ||
if [ -f "/etc/modprobe.d/$ii" ]; then | ||
if [ ! -d "$DESTDIR/etc/modprobe.d" ]; then | ||
mkdir -p $DESTDIR/etc/modprobe.d | ||
fi | ||
cp -p "/etc/modprobe.d/$ii" $DESTDIR/etc/modprobe.d/ | ||
fi | ||
done | ||
|
||
# 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 /boot/zfs ] && cp -r /boot/zfs "$DESTDIR/boot" | ||
[ ! -d "$DESTDIR/boot/zfs" ] && mkdir -p "$DESTDIR/boot/zfs" | ||
[ -f /etc/zfs/zpool.cache ] && cp /etc/zfs/zpool.cache $DESTDIR/boot/zfs/ | ||
|
||
# With pull request #1476 (not yet merged) comes a verbose warning | ||
# if /usr/bin/net doesn't exist or isn't executable. Just create | ||
# a dummy... | ||
[ ! -d "$DESTDIR/usr/bin" ] && mkdir -p "$DESTDIR/usr/bin" | ||
if [ ! -x "$DESTDIR/usr/bin/net" ]; then | ||
touch "$DESTDIR/usr/bin/net" | ||
chmod +x "$DESTDIR/usr/bin/net" | ||
fi | ||
|
||
exit 0 |
Oops, something went wrong.