initramfs-tools: some fixes required by the upcoming OpenRC switch.

* Mount /sys and /proc as sysfs and proc and not "none". Fixes
  an error reported by OpenRC.
* Fix compare_versions() by using xbps-cmpver.

Bump revision.

--HG--
extra : convert_revision : 4e159367fc300083590c393e3d3cbe72a1cb5475
This commit is contained in:
Juan RP 2009-05-02 02:31:23 +02:00
parent 498494add8
commit 931d990154
2 changed files with 66 additions and 52 deletions

View File

@ -1,55 +1,3 @@
--- hook-functions.orig 2008-12-15 01:24:05.000000000 +0100
+++ hook-functions 2008-12-15 01:30:55.000000000 +0100
@@ -414,16 +414,28 @@ EOF
}
+compare_versions()
+{
+ local curv minv
+
+ curv="$(echo $1|sed 's|.||g')"
+ minv="$(echo $2|sed 's|.||g')"
+
+ if [ "$curv" -lt "$minv" ]; then
+ return 1
+ fi
+}
+
# minimal supported kernel version
check_minkver()
{
- local curversion initdir DPKG_ARCH minversion cm_x tmp
+ local curversion initdir ARCH minversion cm_x tmp
curversion="${1}"
initdir="${2}"
if [ -z "${initdir}" ]; then
- DPKG_ARCH=$(dpkg --print-installation-architecture)
- case ${DPKG_ARCH} in
+ ARCH=$(uname -m)
+ case ${ARCH} in
ia64|hppa)
minversion="2.6.15"
;;
@@ -431,7 +443,7 @@ check_minkver()
minversion="2.6.12"
;;
esac
- if dpkg --compare-versions "${curversion}" lt "${minversion}"; then
+ if ! compare_versions "${curversion}" "${minversion}"; then
echo "W: kernel ${curversion} too old for initramfs on ${DPKG_ARCH}" >&2
echo "W: not generating requested initramfs for kernel ${curversion}" >&2
exit 2
@@ -445,7 +457,7 @@ check_minkver()
minver=$(sed '/^MINKVER=/!d;$!d;s/^MINKVER=//;s/[[:space:]]*$//' "${initdir}/${cm_x}")
if [ -z "${tmp}" ]; then
continue
- elif dpkg --compare-versions "${curversion}" lt "${minver}"; then
+ elif ! compare_versions "${curversion}" "${minver}"; then
echo "W: ${cm_x} hook script requires at least kernel version ${minver}" >&2
echo "W: not generating requested initramfs for kernel ${curversion}" >&2
exit 2
--- update-initramfs.orig 2009-03-07 06:30:03.039700454 +0100
+++ update-initramfs 2009-03-07 06:32:05.679694852 +0100
@@ -1,4 +1,4 @@
@ -144,3 +92,68 @@
fi
run_scripts /usr/share/initramfs-tools/hooks
--- init.orig 2009-05-02 02:17:42.338577448 +0200
+++ init 2009-05-02 02:18:01.671572443 +0200
@@ -8,8 +8,8 @@ echo "Loading, please wait..."
[ -d /proc ] || mkdir /proc
[ -d /tmp ] || mkdir /tmp
mkdir -p /var/lock
-mount -t sysfs -o nodev,noexec,nosuid none /sys
-mount -t proc -o nodev,noexec,nosuid none /proc
+mount -t sysfs -o nodev,noexec,nosuid sysfs /sys
+mount -t proc -o nodev,noexec,nosuid proc /proc
# Note that this only becomes /dev on the real filesystem if udev's scripts
# are used; which they will be, but it's worth pointing out
--- hook-functions.orig 2009-03-30 11:48:21.000000000 +0200
+++ hook-functions 2009-05-02 02:21:28.126581591 +0200
@@ -465,16 +465,28 @@ EOF
}
+compare_versions()
+{
+ local curv="$1" minv="$2"
+
+ xbps-cmpver $curv $minv
+ if [ $? -eq 0 -o $? -eq 1 ]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
# minimal supported kernel version
check_minkver()
{
- local curversion initdir DPKG_ARCH minversion cm_x tmp
+ local curversion initdir ARCH minversion cm_x tmp
curversion="${1}"
initdir="${2}"
if [ -z "${initdir}" ]; then
- DPKG_ARCH=$(dpkg --print-installation-architecture)
- case ${DPKG_ARCH} in
+ ARCH=$(uname -m)
+ case ${ARCH} in
ia64|hppa)
minversion="2.6.15"
;;
@@ -482,7 +494,7 @@ check_minkver()
minversion="2.6.12"
;;
esac
- if dpkg --compare-versions "${curversion}" lt "${minversion}"; then
+ if ! compare_versions "${curversion}" "${minversion}"; then
echo "W: kernel ${curversion} too old for initramfs on ${DPKG_ARCH}" >&2
echo "W: not generating requested initramfs for kernel ${curversion}" >&2
exit 2
@@ -496,7 +508,7 @@ check_minkver()
minver=$(sed '/^MINKVER=/!d;$!d;s/^MINKVER=//;s/[[:space:]]*$//' "${initdir}/${cm_x}")
if [ -z "${tmp}" ]; then
continue
- elif dpkg --compare-versions "${curversion}" lt "${minver}"; then
+ elif ! compare_versions "${curversion}" "${minver}"; then
echo "W: ${cm_x} hook script requires at least kernel version ${minver}" >&2
echo "W: not generating requested initramfs for kernel ${curversion}" >&2
exit 2

View File

@ -1,6 +1,7 @@
# Template file for 'initramfs-tools'
pkgname=initramfs-tools
version=0.93.2
revision=1
wrksrc=$pkgname
patch_files="$pkgname-xbps.diff"
distfiles="${DEBIAN_SITE}/main/i/${pkgname}/${pkgname}_${version}.tar.gz"