Add a trigger for creating/updating the initramfs.
It's activated at post-install time, and only if template uses: triggers="initramfs-tools". Use it in the kernel package. Also print a message when a trigger is being run. --HG-- extra : convert_revision : 3f2a0c113ed523e4b09822665cf6d94e30b7d1e4
This commit is contained in:
parent
53747489f0
commit
bbcc9c4b13
|
@ -1,36 +0,0 @@
|
|||
#
|
||||
# This scripts creates the initramfs for the newly installed
|
||||
# kernel package.
|
||||
#
|
||||
case "$2" in
|
||||
pre)
|
||||
;;
|
||||
post)
|
||||
echo "Running $3-$4 post installation hooks..."
|
||||
if [ "$1" = "NOTSET" ]; then
|
||||
mntproc_cmd="mount -t proc proc /proc"
|
||||
umntproc_cmd="umount /proc"
|
||||
mntsys_cmd="mount -t sysfs none /sys"
|
||||
umntsys_cmd="umount /sys"
|
||||
initramfs_cmd="update-initramfs"
|
||||
else
|
||||
mntproc_cmd="chroot $1 mount -t proc proc ./proc"
|
||||
umntproc_cmd="chroot $1 umount ./proc"
|
||||
mntsys_cmd="chroot $1 mount -t sysfs none ./sys"
|
||||
umntsys_cmd="chroot $1 umount ./sys"
|
||||
initramfs_cmd="chroot $1 update-initramfs"
|
||||
fi
|
||||
|
||||
if [ ! -f ./var/lib/initramfs-tools/$4 ]; then
|
||||
initramfs_cmd="$initramfs_cmd -c -k $4"
|
||||
else
|
||||
initramfs_cmd="$initramfs_cmd -u -k $4"
|
||||
fi
|
||||
|
||||
${mntproc_cmd}
|
||||
${mntsys_cmd}
|
||||
${initramfs_cmd}
|
||||
${umntproc_cmd}
|
||||
${umntsys_cmd}
|
||||
;;
|
||||
esac
|
|
@ -17,6 +17,8 @@ long_desc="
|
|||
This package provides the linux kernel image, kernel modules
|
||||
and firmware files."
|
||||
|
||||
triggers="initramfs-tools"
|
||||
|
||||
Add_dependency full glibc
|
||||
Add_dependency full dash
|
||||
Add_dependency full coreutils
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Template file for 'xbps-base-dirs'
|
||||
pkgname=xbps-base-dirs
|
||||
version=0.3
|
||||
version=0.4
|
||||
build_style=custom-install
|
||||
short_desc="xbps base system directories"
|
||||
maintainer="Juan RP <xtraeme@gmail.com>"
|
||||
|
@ -22,7 +22,8 @@ do_install()
|
|||
mkdir -p -m 0750 $DESTDIR/root
|
||||
mkdir -p -m 1777 $DESTDIR/tmp $DESTDIR/var/tmp
|
||||
|
||||
for f in local bin include lib sbin src; do
|
||||
for f in local local/bin local/sbin local/include local/lib \
|
||||
bin include lib sbin src; do
|
||||
mkdir -p $DESTDIR/usr/$f
|
||||
done
|
||||
|
||||
|
@ -50,8 +51,7 @@ do_install()
|
|||
cd $DESTDIR/usr && ln -s lib lib64
|
||||
fi
|
||||
|
||||
for f in info-files; do
|
||||
install -D -m 755 ${XBPS_TRIGGERSDIR}/$f \
|
||||
$DESTDIR/var/db/xbps/triggers/$f
|
||||
for f in $(find $XBPS_TRIGGERSDIR -type f -perm 755); do
|
||||
install -D -m 755 $f $DESTDIR/var/db/xbps/triggers/$(basename $f)
|
||||
done
|
||||
}
|
||||
|
|
|
@ -25,6 +25,8 @@ run)
|
|||
exit 1
|
||||
fi
|
||||
|
||||
echo "Running $trigger trigger..."
|
||||
|
||||
cat $finfometa | while read line; do
|
||||
[ ! -f ./$line ] && continue
|
||||
|
||||
|
|
57
triggers/initramfs-tools
Executable file
57
triggers/initramfs-tools
Executable file
|
@ -0,0 +1,57 @@
|
|||
#!/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
|
||||
[ "$2" != "post-install" ] && exit 1
|
||||
|
||||
echo "Running $trigger trigger..."
|
||||
|
||||
if [ "$(pwd)" = "/" ]; then
|
||||
mntproc_cmd="mount -t proc proc /proc"
|
||||
umntproc_cmd="umount /proc"
|
||||
mntsys_cmd="mount -t sysfs none /sys"
|
||||
umntsys_cmd="umount /sys"
|
||||
initramfs_cmd="update-initramfs"
|
||||
else
|
||||
mntproc_cmd="chroot . mount -t proc proc ./proc"
|
||||
umntproc_cmd="chroot . umount ./proc"
|
||||
mntsys_cmd="chroot . mount -t sysfs none ./sys"
|
||||
umntsys_cmd="chroot . umount ./sys"
|
||||
initramfs_cmd="chroot . update-initramfs"
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
${mntproc_cmd}
|
||||
${mntsys_cmd}
|
||||
${initramfs_cmd}
|
||||
${umntproc_cmd}
|
||||
${umntsys_cmd}
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
Loading…
Reference in New Issue
Block a user