-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move udev initrd hooks into zfsutils to mount zdev-based pools at boot
@todo: Add commit message. Closes: dajhorn/pkg-zfs#39 Closes: openzfs/zfs#811
- Loading branch information
Showing
3 changed files
with
81 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#!/bin/sh | ||
# | ||
# Add ZFS filesystem capabilities to an initrd through update-initramfs. | ||
# | ||
|
||
|
||
# This module depends on these initramfs-tools modules. | ||
PREREQ="udev" | ||
|
||
# ZFS on Linux uses udev for device node creation. | ||
PREREQ_UDEV_RULES="60-zpool.rules 60-zvol.rules" | ||
|
||
# These prerequisites are provided by the zfs package. The zdb utility is not | ||
# strictly required, but it can be useful at the initramfs recovery prompt. | ||
COPY_EXEC_LIST=" \ | ||
/lib/udev/zvol_id \ | ||
/lib/udev/zpool_id \ | ||
" | ||
|
||
# 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/" | ||
mkdir -p "$DESTDIR/lib/udev/rules.d/" | ||
|
||
# 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 $PREREQ_UDEV_RULES | ||
do | ||
if [ -e "/etc/udev/rules.d/$ii" ] | ||
then | ||
cp -p "/etc/udev/rules.d/$ii" "$DESTDIR/lib/udev/rules.d/" | ||
elif [ -e "/lib/udev/rules.d/$ii" ] | ||
then | ||
cp -p "/lib/udev/rules.d/$ii" "$DESTDIR/lib/udev/rules.d/" | ||
else | ||
echo "Error: Missing udev rule: $ii" | ||
echo " This file must be in the /etc/udev/rules.d or /lib/udev/rules.d directory." | ||
exit 1 | ||
fi | ||
done | ||
|
||
for ii in $COPY_EXEC_LIST | ||
do | ||
copy_exec "$ii" | ||
done | ||
|
||
if [ -e "/etc/zfs/" ] | ||
then | ||
cp -a "/etc/zfs/" "$DESTDIR/etc/" | ||
fi |
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 @@ | ||
activate update-initramfs |