void-packages/srcpkgs/xbps-casper/files/hooks/casper

75 lines
1.5 KiB
Bash
Executable File

#!/bin/sh -e
# initramfs hook for casper
PREREQS=""
# Output pre-requisites
prereqs()
{
echo "$PREREQS"
}
case "$1" in
prereqs)
prereqs
exit 0
;;
esac
. ${ROOTDIR}/usr/share/initramfs-tools/hook-functions
manual_add_modules unionfs
# We need losetup
copy_exec ${ROOTDIR}/sbin/losetup /sbin
# Casper hooks
mkdir -p ${DESTDIR}/lib/udev/rules.d
cp -p ${ROOTDIR}/lib/udev/rules.d/60-cdrom_id.rules ${DESTDIR}/lib/udev/rules.d/
copy_exec ${ROOTDIR}/lib/udev/cdrom_id /lib/udev
# cifs boot
if [ -x ${ROOTDIR}/sbin/mount.cifs ]; then
copy_exec ${ROOTDIR}/sbin/mount.cifs /sbin
for x in cifs; do
manual_add_modules ${x}
done
fi
# squashfs
manual_add_modules squashfs
manual_add_modules loop
# random file system modules
manual_add_modules vfat
manual_add_modules ext3
manual_add_modules ext4
# needed for vfat. :-/
manual_add_modules nls_cp437
manual_add_modules nls_utf8
manual_add_modules nls_iso8859-1
# cdrom modules
manual_add_modules sr_mod
manual_add_modules sbp2
manual_add_modules ohci1394
# Casper helpers.
for helper in getty login new-uuid; do
ln -s /sbin/casper-${helper} ${DESTDIR}/bin
done
cp ${ROOTDIR}/usr/share/initramfs-tools/scripts/casper-helpers $DESTDIR/scripts
auto_add_modules net
if [ -e ${ROOTDIR}/etc/casper.conf ]; then
mkdir -p ${DESTDIR}/etc
cp ${ROOTDIR}/etc/casper.conf ${DESTDIR}/etc
fi
if [ "$CASPER_GENERATE_UUID" ]; then
# Unique ID
mkdir -p $DESTDIR/conf
uuidgen -r > $DESTDIR/conf/uuid.conf
fi