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 '-').
- Loading branch information
Showing
6 changed files
with
610 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,100 @@ | ||
#!/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 spl | ||
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 "$DESTDIR/boot/zfs" ] && mkdir -p "$DESTDIR/boot/zfs" | ||
[ -d /boot/zfs ] && cp -r /boot/zfs "$DESTDIR/boot" | ||
|
||
# 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.