From 49430c3e66350db70ae6322d32e04daec0790bc4 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sat, 3 Oct 2009 08:33:36 +0200 Subject: [PATCH] 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 --- templates/xbps-base-files/template | 2 +- triggers/initramfs-tools | 34 ++++++++++++++++++++---------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/templates/xbps-base-files/template b/templates/xbps-base-files/template index 2bbb8dd0edc..b88d8130e06 100644 --- a/templates/xbps-base-files/template +++ b/templates/xbps-base-files/template @@ -1,6 +1,6 @@ # Template file for 'xbps-base-files' pkgname=xbps-base-files -version=0.22 +version=0.23 build_style=custom-install short_desc="xbps base system files" maintainer="Juan RP " diff --git a/triggers/initramfs-tools b/triggers/initramfs-tools index a04a62aa9c1..6d26b54fab7 100755 --- a/triggers/initramfs-tools +++ b/triggers/initramfs-tools @@ -1,4 +1,4 @@ -#!/bin/sh +#!/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 @@ -9,22 +9,34 @@ # $3 = pkgname # $4 = version # -case "$1" in +ACTION="$1" +TARGET="$2" +PKGNAME="$3" +VERSION="$4" + +update_initramfs=usr/sbin/update-initramfs + +case "$ACTION" in targets) echo "post-install" ;; run) - [ ! -x usr/sbin/update-initramfs ] && exit 0 - [ "$2" != "post-install" ] && exit 1 + [ ! -x ${update_initramfs} ] && exit 0 + [ "$TARGET" != "post-install" ] && exit 1 - initramfs_cmd="update-initramfs" + initramfs_args="update-initramfs" - 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)" + 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 - initramfs_cmd="$initramfs_cmd -u -k $4" + # Update initramfs for all kernels + initramfs_args="-u -k all" fi if [ ! -e /proc/filesystems ]; then @@ -37,7 +49,7 @@ run) sys_mounted=1 fi - ${initramfs_cmd} + ${update_initramfs} ${initramfs_args} if [ -n "$proc_mounted" ]; then umount /proc