void-packages/templates/initramfs-tools/initramfs-tools-xbps.diff
Juan RP 931d990154 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
2009-05-02 02:31:23 +02:00

159 lines
4.7 KiB
Diff

--- 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 @@
-#!/bin/sh
+#!/bin/sh -e
STATEDIR=/var/lib/initramfs-tools
BOOTDIR=/boot
@@ -8,22 +8,8 @@ USETRIGGERS=true
mode=""
version=""
-set -e
-
[ -r ${CONF} ] && . ${CONF}
-if $USETRIGGERS \
- && [ x"$DPKG_MAINTSCRIPT_PACKAGE" != x ] \
- && [ $# = 1 ] \
- && [ x"$1" = x-u ] \
- && dpkg-trigger --check-supported 2>/dev/null
-then
- if dpkg-trigger --no-await update-initramfs; then
- echo "update-initramfs: deferring update (trigger activated)"
- exit 0
- fi
-fi
-
usage()
{
if [ -n "${1}" ]; then
@@ -313,7 +299,8 @@ get_sorted_versions()
fi
worklist=""
for gsv_i in $version_list; do
- if dpkg --compare-versions "${gsv_x}" '>' "${gsv_i}"; then
+ rv=$(xbps-cmpver "${gsv_x}" "${gsv_i}")
+ if [ "$rv" -eq 0 ]; then
worklist="${worklist} ${gsv_x} ${gsv_i}"
gsv_x=""
else
--- mkinitramfs.orig 2009-02-17 15:56:33.000000000 +0100
+++ mkinitramfs 2009-03-08 04:05:23.555799879 +0100
@@ -8,8 +8,7 @@ keep="n"
CONFDIR="/etc/initramfs-tools"
verbose="n"
errors_to="2>/dev/null"
-# BUSYBOXDIR="/usr/lib/initramfs-tools/bin/"
-BUSYBOXDIR="/bin"
+BUSYBOXDIR="/usr/lib/initramfs-tools/bin/"
OPTIONS=`getopt -o d:ko:r:v -n "$0" -- "$@"`
@@ -141,7 +140,7 @@ fi
DESTDIR="$(mktemp -t -d mkinitramfs_XXXXXX)" || exit 1
__TMPCPIOGZ="$(mktemp -t mkinitramfs-OL_XXXXXX)" || exit 1
-DPKG_ARCH=`dpkg --print-installation-architecture`
+DPKG_ARCH=`uname -m`
# Export environment for hook scripts.
#
@@ -232,7 +231,6 @@ fi
# Busybox
if [ "${BUSYBOX}" = "n" ] || [ ! -e ${BUSYBOXDIR}/busybox ]; then
- mv ${DESTDIR}/bin/sh.shared ${DESTDIR}/bin/sh
# those root need busybox
eval "$(mount | awk '/ \/ / {print "r_dev=" $1; exit}')"
if [ "${r_dev#/dev/mapper/}" != "${r_dev}" ]; then
@@ -246,15 +244,14 @@ else
fi
# Modutils
-copy_exec /sbin/modprobe /sbin
-copy_exec /sbin/depmod /sbin
-copy_exec /sbin/rmmod /sbin
-mkdir -p "${DESTDIR}/etc/modprobe.d"
-cp -a /etc/modprobe.d/* "${DESTDIR}/etc/modprobe.d/"
-
-# workaround: libgcc always needed on old-abi arm
-if [ "$DPKG_ARCH" = arm ] || [ "$DPKG_ARCH" = armeb ]; then
- cp -a /lib/libgcc_s.so.1 "${DESTDIR}/lib/"
+copy_exec /usr/lib/klibc/sbin/modprobe /sbin
+copy_exec /usr/lib/klibc/sbin/depmod /sbin
+copy_exec /usr/lib/klibc/sbin/lsmod /sbin
+copy_exec /usr/lib/klibc/sbin/rmmod /sbin
+copy_exec /usr/lib/klibc/sbin/insmod /sbin
+if [ -d /etc/modprobe.d ]; then
+ mkdir -p "${DESTDIR}/etc/modprobe.d"
+ cp -a /etc/modprobe.d/* "${DESTDIR}/etc/modprobe.d/"
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