initramfs-tools: sync with latest debian version 0.98.8.

This commit is contained in:
Juan RP 2011-02-13 17:43:18 +01:00
parent f565c2d8ee
commit 9ce11c5d06
12 changed files with 187 additions and 66 deletions

View file

@ -0,0 +1,26 @@
# update-initramfs(8) completion
_update_initramfs()
{
local cur prev valid_options
# TODO: this can be "_get_comp_words_by_ref cur prev" once
# bash-completion >= 1.2 is available, see #537139
cur=$(_get_cword)
prev=${COMP_WORDS[COMP_CWORD-1]}
# The only option that takes an argument is -k
if [[ "$prev" == '-k' ]]; then
# Complete with kernel versions
_kernel_versions
COMPREPLY=( $( compgen -W '${COMPREPLY[@]} all' -- "$cur" ) )
return;
fi
# Complete with available options (obtained from -h)
valid_options=$( update-initramfs -h 2>&1 | \
sed -e '/^ -/!d;s/^ \(-\w\+\).*/\1/' )
COMPREPLY=( $( compgen -W "$valid_options" -- $cur ) )
}
complete -F _update_initramfs update-initramfs

View file

@ -2,7 +2,7 @@
# initramfs.conf
# Configuration file for mkinitramfs(8). See initramfs.conf(5).
#
# Note that configuration options from this file can be overriden
# Note that configuration options from this file can be overridden
# by config files in the /etc/initramfs-tools/conf.d directory.
#
@ -51,7 +51,7 @@ BOOT=local
# DEVICE: ...
#
# Specify a specific network interface, like eth0
# Overriden by optional ip= bootarg
# Overridden by optional ip= bootarg
#
DEVICE=

View file

@ -1,4 +1,5 @@
# List of modules that you want to include in your initramfs.
# They will be loaded at boot time in the order below.
#
# Syntax: module_name [args ...]
#

View file

@ -14,7 +14,7 @@ update_initramfs=yes
#
# backup_initramfs [ yes | no ]
#
# Default is yes
# Default is no
# If set to no leaves no .bak backup files.
backup_initramfs=yes
backup_initramfs=no

View file

@ -229,7 +229,7 @@ dep_add_modules()
# On failure fallback to /proc/mounts if readable
if [ -z "$root" ] && [ -r /proc/mounts ]; then
eval "$(awk '/\/dev\// {if ($2 == "/") {print "root=" $1 "\nFSTYPE=" $5; exit}}' /proc/mounts)"
eval "$(awk '!/^rootfs / {if ($2 == "/") {print "root=" $1 "\nFSTYPE=" $3; exit}}' /proc/mounts)"
fi
# recheck root device
@ -299,12 +299,16 @@ dep_add_modules()
# md root new naming scheme /dev/md/X
elif [ "${root#/dev/md/}" != "${root}" ]; then
root=${root#/dev/md/}
# strip partion number
root=${root%%p[0-9]*}
# drop the partition number only for sdX and hdX devices
# and keep it for other devices like loop#, dm-# devices
block=$(sed -ne 's/multipath/[/' -e 's/linear/[/' -e 's/raid[0-9][0-9]*/[/' -e 's/\([hs]d[a-z][a-z]*\)[0-9][0-9]*/\1/g' -e '/^md'$root' :/s/^[^[]*\[ \([^\[]*\)\[.*$/\1/p' </proc/mdstat)
# md root /dev/mdX
elif [ "${root#/dev/md}" != "${root}" ]; then
root=${root#/dev/md}
# strip partion number
root=${root%%p[0-9]*}
# drop the partition number only for sdX and hdX devices
# and keep it for other devices like loop#, dm-# devices
block=$(sed -ne 's/multipath/[/' -e 's/linear/[/' -e 's/raid[0-9][0-9]*/[/' -e 's/\([hs]d[a-z][a-z]*\)[0-9][0-9]*/\1/g' -e '/^md'$root' :/s/^[^[]*\[ \([^\[]*\)\[.*$/\1/p' </proc/mdstat)
@ -340,6 +344,10 @@ dep_add_modules()
block="rd!c${root#/dev/rd/c}"
block=${block%%p[0-9]*}
# etherd device
elif [ "${root#/dev/etherd/}" != "${root}" ]; then
block=${root#/dev/etherd/*}
block="etherd!${block%p*}"
# classical root device
else
block=${root#/dev/}
@ -359,7 +367,7 @@ dep_add_modules()
sys_walk_mod_add ${root_dev_path}
# catch old-style IDE
if [ -e /sys/bus/ide/devices/ ]; then
if [ -d "${DESTDIR}/lib/modules/${version}/kernel/drivers/ide" ]; then
sys_walk_modalias ${root_dev_path}
manual_add_modules ide-gd_mod
# FIXME: remove post Squeeze
@ -367,7 +375,7 @@ dep_add_modules()
manual_add_modules ide-cd
fi
if [ -e /sys/bus/scsi/devices/ ]; then
if [ -d "${DESTDIR}/lib/modules/${version}/kernel/drivers/scsi" ]; then
manual_add_modules sd_mod
fi
@ -410,11 +418,6 @@ auto_add_modules()
manual_add_modules "${x}"
done
;;
kms)
for x in fbcon intel_agp radeon i915; do
manual_add_modules "${x}"
done
;;
net)
copy_modules_dir kernel/drivers/net \
appletalk arcnet bonding can hamradio irda pcmcia \
@ -468,7 +471,6 @@ auto_add_modules()
;;
*)
auto_add_modules base
auto_add_modules kms
auto_add_modules net
auto_add_modules ide
auto_add_modules scsi
@ -484,6 +486,20 @@ auto_add_modules()
esac
}
# 'depmod' only looks at symbol dependencies; there is no way for
# modules to declare explicit dependencies through module information,
# so dependencies on e.g. crypto providers are hidden. Until this is
# fixed, we need to handle those hidden dependencies.
hidden_dep_add_modules()
{
for dep in "lib/libcrc32c crc32c"; do
set -- $dep
if [ -f "${DESTDIR}/lib/modules/${version}/kernel/$1.ko" ]; then
manual_add_modules "$2"
fi
done
}
# mkinitramfs help message
usage()
{

View file

@ -0,0 +1,68 @@
#!/bin/sh
PREREQ=""
prereqs()
{
echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
prereqs
exit 0
;;
esac
# Hooks for loading thermal bits into the initramfs
. /usr/share/initramfs-tools/hook-functions
case "$DPKG_ARCH" in
# copy the right modules
powerpc|ppc64)
# Only G5 Mac machines need to load
# therm_pm72 or one of the windfarm_pm* modules.
[ -r /proc/cpuinfo ] || exit 0
MODEL="`grep model /proc/cpuinfo`"
MODEL="${MODEL##*: }"
case "$MODEL" in
RackMac3,1|PowerMac7,2|PowerMac7,3)
force_load therm_pm72
;;
PowerMac8,1|PowerMac8,2)
force_load windfarm_pm81
;;
PowerMac9,1)
force_load windfarm_pm91
;;
PowerMac11,2)
force_load windfarm_pm112
;;
PowerMac12,1)
force_load windfarm_pm121
;;
*)
# No other machine needs windfarm_* modules on initrd.
exit 0
;;
esac
manual_add_modules windfarm_core
manual_add_modules windfarm_cpufreq_clamp
manual_add_modules windfarm_lm75_sensor
manual_add_modules windfarm_max6690_sensor
manual_add_modules windfarm_pid
manual_add_modules windfarm_smu_controls
manual_add_modules windfarm_smu_sat
manual_add_modules windfarm_smu_sensors
;;
i386|amd64|ia64)
manual_add_modules fan
manual_add_modules thermal
;;
esac

View file

@ -24,7 +24,7 @@ directly.
Specifies the modules for the initramfs image.
The default setting is \fImost\fP.
\fImost\fP adds most file system, all video KMS, all ide, sata, scsi and usb drivers.
\fImost\fP adds most file system, all ide, sata, scsi and usb drivers.
\fIdep\fP tries to guess which modules are necessary for the running box.
@ -82,10 +82,6 @@ The initramfs-tools are written by Maximilian Attems <maks@debian.org>,
Jeff Bailey <jbailey@raspberryginger.com> and numerous others.
Loosely based on mkinitrd.conf by Herbert Xu.
This version of initramfs-tools has been modified and improved by
Juan Romero Pardines <xtraeme@gmail.com> for XBPS - The X Binary
Package System.
.SH SEE ALSO
.BR
.IR initramfs-tools (8),

View file

@ -166,11 +166,9 @@ chmod 755 "${DESTDIR}"
# do not execute cache_run_scripts() if mounted with noexec
NOEXEC=""
if [ -r /etc/mtab ]; then
fs=$(df $DESTDIR | tail -1 | awk '{print $6}')
if [ -n "$fs" ] && mount | grep -q "on $fs .*noexec" ; then
fs=$(df -P $DESTDIR | tail -1 | awk '{print $6}')
if [ -n "$fs" ] && mount | grep -q "on $fs .*noexec" ; then
NOEXEC=1
fi
fi
__TMPCPIOGZ="$(mktemp ${TMPDIR:-/tmp}/mkinitramfs-OL_XXXXXX)" || exit 1
@ -230,6 +228,9 @@ list)
;;
esac
# Resolve hidden dependencies
hidden_dep_add_modules
# Have to do each file, because cpio --dereference doesn't recurse down
# symlinks.
@ -271,7 +272,6 @@ if ! command -v ldd >/dev/null 2>&1 ; then
fi
# module-init-tools
copy_exec /sbin/depmod /sbin
copy_exec /sbin/modprobe /sbin
copy_exec /sbin/rmmod /sbin
mkdir -p "${DESTDIR}/etc/modprobe.d"

View file

@ -2,7 +2,7 @@
_log_msg()
{
[ "$quiet" = "y" ] && return
if [ "$quiet" = "y" ]; then return; fi
printf "\033[1m"
printf "$@"
printf "\033[m\n"
@ -25,16 +25,30 @@ log_warning_msg()
log_begin_msg()
{
if [ -x /sbin/usplash_write ]; then
/sbin/usplash_write "TEXT $@"
fi
_log_msg "$@ ..."
}
log_end_msg()
{
if [ -x /sbin/usplash_write ]; then
/sbin/usplash_write "SUCCESS ok"
fi
:
}
panic()
{
if [ -x /sbin/usplash_write ]; then
/sbin/usplash_write "QUIT"
fi
if command -v chvt >/dev/null 2>&1; then
chvt 1
fi
# Disallow console access
if [ -n "${panic}" ]; then
sleep ${panic}
@ -67,7 +81,7 @@ set_initlist()
# only allow variable name chars
case ${si_x#${initdir}/} in
*[![:alnum:]_.]*)
*[![:alnum:]\._-]*)
[ "${verbose}" = "y" ] \
&& echo "$si_x ignored: not alphanumeric or '_' file"
continue
@ -88,7 +102,14 @@ set_initlist()
continue
fi
initlist="${initlist} ${si_x#${initdir}/}"
# skip bad syntax
if ! sh -n ${si_x} ; then
[ "${verbose}" = "y" ] \
&& echo "$si_x ignored: bad syntax"
continue
fi
initlist="${initlist:-} ${si_x#${initdir}/}"
done
}
@ -99,18 +120,17 @@ reduce_satisfied()
for rs_y in ${deplist}; do
# only allow variable name chars
case ${rs_y} in
*[![:alnum:]_.]*)
*[![:alnum:]\._-]*)
continue
;;
esac
# skip non executable scripts
if [ ! -x ${initdir}/${rs_y} ]; then
continue
fi
[ ! -x ${initdir}/${rs_y} ] && continue
# skip directories
if [ -d ${initdir}/${rs_y} ]; then
continue
fi
[ -d ${initdir}/${rs_y} ] && continue
# skip bad syntax
sh -n ${initdir}/${rs_y} || continue
tmpdeplist="${tmpdeplist} ${rs_y}"
done
deplist=${tmpdeplist}
@ -193,18 +213,26 @@ get_prereq_pairs()
call_scripts()
{
set -e
for cs_x in ${runlist}; do
[ -f ${initdir}/${cs_x} ] || continue
# mkinitramfs verbose output
if [ "${verbose}" = "y" ]; then
echo "Calling hook ${cs_x}"
fi
${initdir}/${cs_x}
# allow boot scripts to modify exported boot paramaters
${initdir}/${cs_x} && ec=$? || ec=$?
# allow hooks to abort build:
if [ "$ec" -ne 0 ]; then
echo "E: ${initdir}/${cs_x} failed with return $ec."
# only errexit on mkinitramfs
[ -n "${version}" ] && exit $ec
fi
# allow boot scripts to modify exported boot parameters
if [ -e /conf/param.conf ]; then
. /conf/param.conf
fi
done
set +e
}
run_scripts()
@ -345,9 +373,9 @@ configure_networking()
# The NIC is to be configured if this file does not exist.
# Ip-Config tries to create this file and when it succeds
# creating the file, ipconfig is not run again.
if [ -e /tmp/net-"${DEVICE}".conf ]; then
break;
fi
for x in /tmp/net-"${DEVICE}".conf /tmp/net-*.conf ; do
[ -e "$x" ] && break 2
done
case ${IP} in
none|off)

View file

@ -1,18 +0,0 @@
#!/bin/sh
PREREQ=""
prereqs()
{
echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
prereqs
exit 0
;;
esac
# Always load the fbcon module for KMS, won't do any harm for
# other users anyway.
modprobe fbcon

View file

@ -1,7 +1,7 @@
# Template file for 'initramfs-tools'
pkgname=initramfs-tools
_localver=0.99.8.0 # This is the XBPS version
_distver=0.98.5 # This should match debian version
_distver=0.98.8 # This should match debian version
version=${_localver}.${_distver}
build_style=custom-install
short_desc="Tools for generating an initramfs"
@ -97,4 +97,8 @@ do_install()
install -m 755 $FILESDIR/update-initramfs $DESTDIR/usr/sbin
install -m 755 $FILESDIR/lsinitramfs $DESTDIR/usr/sbin
sed -i -e "s|@VERSION@|${version}|g" $DESTDIR/usr/sbin/update-initramfs
# bash_completion.d
install -D -m644 $FILESDIR/bash_completion.d/initramfs-tools \
${DESTDIR}/etc/bash_completion.d/initramfs-tools
}