2010-11-04 12:53:46 +00:00
|
|
|
#!/bin/sh -e
|
|
|
|
#
|
2011-07-09 22:03:17 +00:00
|
|
|
# Runs update-initramfs(8) to update initramfs for all installed kernels.
|
2010-11-04 12:53:46 +00:00
|
|
|
#
|
|
|
|
# Arguments: $ACTION = [run/targets]
|
|
|
|
# $TARGET = [post-install/post-remove]
|
|
|
|
# $PKGNAME
|
|
|
|
# $VERSION
|
|
|
|
# $UPDATE = [yes/no]
|
|
|
|
#
|
|
|
|
ACTION="$1"
|
|
|
|
TARGET="$2"
|
|
|
|
PKGNAME="$3"
|
|
|
|
VERSION="$4"
|
|
|
|
UPDATE="$5"
|
|
|
|
|
2011-07-01 13:22:10 +00:00
|
|
|
export PATH="$PATH:/usr/local/bin"
|
|
|
|
|
2010-11-04 12:53:46 +00:00
|
|
|
update_initramfs=usr/sbin/update-initramfs
|
|
|
|
|
|
|
|
case "$ACTION" in
|
|
|
|
targets)
|
|
|
|
echo "post-install post-remove"
|
|
|
|
;;
|
|
|
|
run)
|
|
|
|
# Exit if the command cannot be executed.
|
|
|
|
[ ! -x ${update_initramfs} ] && exit 0
|
|
|
|
|
|
|
|
# Cannot continue if /proc and /sys not mounted!
|
|
|
|
if [ ! -e ./proc/filesystems -a ! -e ./sys/kernel/vmcoreinfo ]; then
|
|
|
|
echo "initramfs-tools trigger:"
|
|
|
|
echo "WARNING: /proc and /sys (relative to cwd) are not mounted"
|
|
|
|
echo "WARNING: cannot continue, exiting..."
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Always use relative paths to create the initramfs!
|
|
|
|
initramfs_args="-b ./boot"
|
|
|
|
|
2011-07-09 22:03:17 +00:00
|
|
|
# Update initramfs for all kernels
|
|
|
|
initramfs_args="$initramfs_args -u -t -k all"
|
2010-11-04 12:53:46 +00:00
|
|
|
|
2011-11-10 13:03:58 +00:00
|
|
|
env ROOTDIR="." ${update_initramfs} ${initramfs_args}
|
2010-11-04 12:53:46 +00:00
|
|
|
exit $?
|
|
|
|
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|