void-packages/triggers/initramfs-tools
Juan RP 931c03fae1 xbps-base-files: more fixes for the initramfs-tools trigger.
Test /proc/filesystems and /sys/kernel/vmcoreinfo to know
if /proc and /sys are mounted, as the former was required
for mountinfo. This finally works while installing a package
with and without rootdir.

Bump revision.

--HG--
extra : convert_revision : df009b5088c47931d7ae82af2c4f7dad9af5337f
2009-05-06 07:54:56 +02:00

59 lines
1.2 KiB
Bash
Executable file

#!/bin/sh
#
# Runs update-initramfs(8) to create/update an initramfs for specified
# version (if the pkg that is triggering it) or for the currently
# installed kernel otherwise.
#
# Arguments: $1 = action [run/targets]
# $2 = target [post-install]
# $3 = pkgname
# $4 = version
#
trigger="initramfs-tools"
case "$1" in
targets)
echo "post-install"
;;
run)
[ ! -x usr/sbin/update-initramfs ] && exit 0
[ ! -x lib/rc/bin/mountinfo ] && exit 0
[ "$2" != "post-install" ] && exit 1
echo "Running $trigger trigger..."
initramfs_cmd="update-initramfs"
if [ "$3" = "kernel" -a ! -f ./var/lib/initramfs-tools/$4 ]; then
initramfs_cmd="$initramfs_cmd -c -k $4"
elif [ "$3" != "kernel" -o ! -f ./var/lib/initramfs-tools/$4 ]; then
initramfs_cmd="$initramfs_cmd -c -k $(xbps-pkgdb version kernel)"
else
initramfs_cmd="$initramfs_cmd -u -k $4"
fi
if [ ! -e /proc/filesystems ]; then
mount -t proc proc /proc
proc_mounted=1
fi
if [ ! -e /sys/kernel/vmcoreinfo ]; then
mount -t sysfs sysfs /sys
sys_mounted=1
fi
${initramfs_cmd}
if [ -n "$proc_mounted" ]; then
umount /proc
fi
if [ -n "$sys_mounted" ]; then
umount /sys
fi
;;
*)
exit 1
;;
esac
exit 0