initramfs-tools: kernel hooks support, remove -B flag.

This commit is contained in:
Juan RP 2011-07-10 00:02:10 +02:00
parent 1cf57eab23
commit b2c180073d
5 changed files with 43 additions and 46 deletions

View file

@ -0,0 +1,15 @@
#!/bin/sh
#
# Kernel post-install hook for initramfs-tools.
#
# Arguments passed to this script: $1 pkgname, $2 version.
#
PKGNAME="$1"
VERSION="$2"
if [ ! -x /usr/sbin/update-initramfs ]; then
exit 0
fi
/usr/sbin/update-initramfs -c -t -k ${VERSION}
exit $?

View file

@ -0,0 +1,15 @@
#!/bin/sh
#
# Kernel post-remove hook for initramfs-tools.
#
# Arguments passed to this script: $1 pkgname, $2 version.
#
PKGNAME="$1"
VERSION="$2"
if [ ! -x /usr/sbin/update-initramfs ]; then
exit 0
fi
/usr/sbin/update-initramfs -d -t -k ${VERSION}
exit $?

View file

@ -24,7 +24,6 @@ Options:
-d Remove an existing initramfs
-t Take over a custom initramfs with this one
-b Set alternate boot directory
-B Do not update bootloader configuration file
-v Be verbose
-V Show initramfs-tools version
-h This message
@ -160,32 +159,6 @@ generate_initramfs()
fi
}
# Invoke bootloader
run_bootloader()
{
local grub_installed
[ -r /boot/grub/grub.cfg ] \
&& groot=$(awk '/^set root=/{print substr($2, 8, 3); exit}' \
/boot/grub/grub.cfg)
[ -e /boot/grub/device.map ] && [ -n "${groot}" ] \
&& dev=$(awk "/${groot}/{ print \$NF}" /boot/grub/device.map)
if [ -n "${dev}" -a -r "${dev}" ]; then
dd if="${dev}" bs=512 skip=0 count=1 2>/dev/null|grep -q GRUB
[ $? -eq 0 ] && grub_installed=1
fi
if [ -n "${dev}" -a -z "$grub_installed" ]; then
echo "WARNING: GRUB2 has not been installed into ${dev}."
echo "update-initramfs: please run 'grub-install ${dev}'."
fi
if command -v grub-mkconfig >/dev/null 2>&1; then
grub-mkconfig -o /boot/grub/grub.cfg
fi
}
compare_sha1()
{
sha1sum "${initramfs}" | diff "${STATEDIR}/${version}" - >/dev/null 2>&1
@ -303,8 +276,6 @@ create()
fi
generate_initramfs
[ -n "${dogrub}" ] && run_bootloader
}
update()
@ -369,8 +340,6 @@ delete()
delete_sha1
rm -f "${initramfs}" "${initramfs}.bak"
[ -n "${dogrub}" ] && run_bootloader
}
# Check for update mode on existing and modified initramfs
@ -392,15 +361,11 @@ verbose=0
yes=0
# We default to takeover=1 in Ubuntu, but not Debian
takeover=0
dogrub=1
##
while getopts "k:cudyvtb:h?BV" flag; do
while getopts "k:cudyvtb:h?V" flag; do
case "${flag}" in
B)
unset dogrub
;;
k)
version="${OPTARG}"
;;

View file

@ -1,4 +1,4 @@
.TH UPDATE-INITRAMFS 8 "2010/02/25" "Linux" "update\-initramfs manual"
.TH UPDATE-INITRAMFS 8 "2011/07/09" "Linux" "update\-initramfs manual"
.SH NAME
update\-initramfs \- generate an initramfs image
@ -12,7 +12,6 @@ update\-initramfs \- generate an initramfs image
.RB [ \-v ]
.RB [ \-V ]
.RB [ \-b ]
.RB [ \-B ]
.RB [ \-h ]
.SH DESCRIPTION
The
@ -71,11 +70,6 @@ Prints the current initramfs-tools version.
\fB \-b
Set an different bootdir for the image creation.
.TP
\fB \-B
Do not update the boot configuration file (grub.cfg for grub2) after
building successfully the initramfs.
.TP
\fB \-h
Print a short help page describing the available options in
@ -97,9 +91,9 @@ Create the initramfs for a specific kernel:
/etc/initramfs-tools/update-initramfs.conf
.SH AUTHOR
The initramfs-tools available in XBPS are maintained by
The initramfs-tools from Vanilla are maintained by
Juan Romero Pardines <xtraeme@gmail.com>, they diverged substantially
from the original implementation comming from Debian.
from the original implementation coming from Debian.
The initramfs-tools from Debian are written by Maximilian Attems <maks@debian.org>,
Jeff Bailey <jbailey@raspberryginger.com> and numerous others.

View file

@ -1,11 +1,13 @@
# Template file for 'initramfs-tools'
pkgname=initramfs-tools
_localver=0.99.19 # This is the XBPS version
_localver=0.99.20 # This is the XBPS version
_distver=0.98.8 # This should match debian version
version=${_localver}.${_distver}
build_style=custom-install
short_desc="Tools for generating an initramfs"
maintainer="Juan RP <xtraeme@gmail.com>"
homepage="http://vanilla.github.com"
license="GPL-2"
long_desc="
This package contains tools to create and boot an initramfs for packaged 2.6
Linux kernel. The initramfs is a gzipped cpio archive. At boot time, the
@ -100,4 +102,10 @@ do_install()
# bash_completion.d
install -D -m644 $FILESDIR/bash_completion.d/initramfs-tools \
${DESTDIR}/etc/bash_completion.d/initramfs-tools
# Kernel hooks
vinstall ${FILESDIR}/kernel.d/${pkgname}.postinst \
755 etc/kernel.d/post-install 10-${pkgname}
vinstall ${FILESDIR}/kernel.d/${pkgname}.postrm \
755 etc/kernel.d/post-remove 10-${pkgname}
}