2009-03-12 11:50:46 +01:00
|
|
|
#!/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
|
|
|
|
#
|
|
|
|
case "$1" in
|
|
|
|
targets)
|
|
|
|
echo "post-install"
|
|
|
|
;;
|
|
|
|
run)
|
2009-05-05 05:28:24 +02:00
|
|
|
[ ! -x usr/sbin/update-initramfs ] && exit 0
|
2009-03-12 11:50:46 +01:00
|
|
|
[ "$2" != "post-install" ] && exit 1
|
|
|
|
|
2009-04-08 03:23:09 +02:00
|
|
|
initramfs_cmd="update-initramfs"
|
2009-03-12 11:50:46 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2009-05-06 07:54:56 +02:00
|
|
|
if [ ! -e /proc/filesystems ]; then
|
2009-05-05 05:28:24 +02:00
|
|
|
mount -t proc proc /proc
|
|
|
|
proc_mounted=1
|
|
|
|
fi
|
2009-05-06 07:54:56 +02:00
|
|
|
|
|
|
|
if [ ! -e /sys/kernel/vmcoreinfo ]; then
|
2009-05-05 05:28:24 +02:00
|
|
|
mount -t sysfs sysfs /sys
|
|
|
|
sys_mounted=1
|
|
|
|
fi
|
|
|
|
|
2009-03-12 11:50:46 +01:00
|
|
|
${initramfs_cmd}
|
2009-05-05 05:28:24 +02:00
|
|
|
|
|
|
|
if [ -n "$proc_mounted" ]; then
|
|
|
|
umount /proc
|
|
|
|
fi
|
|
|
|
if [ -n "$sys_mounted" ]; then
|
|
|
|
umount /sys
|
|
|
|
fi
|
2009-03-12 11:50:46 +01:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|