vp-build/triggers/initramfs-tools
Juan RP 49430c3e66 xbps-base-files: revamped initramfs-tools trigger.
The initramfs-tools trigger has been improved to allow rebuilding
all initramfs when a package != kernel runs it.

Bump to 0.23.

--HG--
extra : convert_revision : ca2da46184b8a879ba0e24eff1f79ae75f539449
2009-10-03 08:33:36 +02:00

67 lines
1.2 KiB
Bash
Executable File

#!/bin/sh -e
#
# 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
#
ACTION="$1"
TARGET="$2"
PKGNAME="$3"
VERSION="$4"
update_initramfs=usr/sbin/update-initramfs
case "$ACTION" in
targets)
echo "post-install"
;;
run)
[ ! -x ${update_initramfs} ] && exit 0
[ "$TARGET" != "post-install" ] && exit 1
initramfs_args="update-initramfs"
if [ "$PKGNAME" = "kernel" ]; then
if [ ! -f var/lib/initramfs-tools/${VERSION} ]; then
# Create new initramfs
initramfs_args="-c -k ${VERSION}"
else
# Update existing initramfs
initramfs_args="-u -k ${VERSION}"
fi
else
# Update initramfs for all kernels
initramfs_args="-u -k all"
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
${update_initramfs} ${initramfs_args}
if [ -n "$proc_mounted" ]; then
umount /proc
fi
if [ -n "$sys_mounted" ]; then
umount /sys
fi
;;
*)
exit 1
;;
esac
exit 0