vp-build/templates/initramfs-tools/initramfs-tools-xbps.diff
Juan RP 66d268cdd1 initramfs-tools: use the new klibc pkgs, saves ~1.5MBs.
--HG--
extra : convert_revision : 4a6e3452348cec1a4bd3e8ad6e514f470eb2c7d8
2009-03-08 04:15:11 +01:00

147 lines
4.1 KiB
Diff

--- 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 @@
-#!/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