mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 18:11:00 +03:00
48511ea645
This is some minor fixes to commits2cac7f5f11
and2a34db1bdb
. * Make sure to alien'ate the new initramfs rpm package as well! The rpm package is build correctly, but alien isn't run on it to create the deb. * Before copying file from COPY_FILE_LIST, make sure the DESTDIR/dir exists. * Include /lib/udev/vdev_id file in the initrd. * Because the initrd needs to use '/sbin/modprobe' instead of 'modprobe', we need to use this in load_module() as well. * Make sure that load_module() can be used more globaly, instead of calling '/sbin/modprobe' all over the place. * Make sure that check_module_loaded() have a parameter - module to check. Signed-off-by: Turbo Fredriksson <turbo@bayour.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #3626
104 lines
2.5 KiB
Bash
Executable File
104 lines
2.5 KiB
Bash
Executable File
#!/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"
|
|
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"
|
|
|
|
# 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 $COPY_FILE_LIST
|
|
do
|
|
dir=$(dirname "$ii")
|
|
[ -d "$dir" ] && mkdir -p "$DESTDIR/$dir"
|
|
[ -f "$ii" ] && cp -p "$ii" "$DESTDIR/$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
|
|
|
|
# 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
|