void-packages/xbps-src/triggers/initramfs-tools
Juan RP 4c2cc8b588 Add a trigger to (un)register system user/groups.
The following vars can be used for this:

- system_accounts="foo blah"
- foo_homedir, foo_shell, foo_descr, foo_groups.

--HG--
extra : convert_revision : bc7d002e00abc5c84f83a3716a8ecf97f9c9ff24
2009-12-11 12:03:21 +01:00

70 lines
1.3 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: $ACTION = [run/targets]
# $TARGET = [post-install/post-remove]
# $PKGNAME
# $VERSION
# $UPDATE = [yes/no]
#
ACTION="$1"
TARGET="$2"
PKGNAME="$3"
VERSION="$4"
UPDATE="$5"
update_initramfs=usr/sbin/update-initramfs
case "$ACTION" in
targets)
echo "post-install post-remove"
;;
run)
[ ! -x ${update_initramfs} ] && exit 0
initramfs_args="update-initramfs"
if [ "$PKGNAME" = "kernel" ]; then
if [ "$TARGET" = "post-remove" ]; then
exit 0
fi
if [ ! -f var/lib/initramfs-tools/${VERSION} ]; then
# Create new initramfs
initramfs_args="-c -t -k ${VERSION}"
else
# Update existing initramfs
initramfs_args="-u -t -k ${VERSION}"
fi
else
# Update initramfs for all kernels
initramfs_args="-u -t -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