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 # initramfs.conf
# Configuration file for mkinitramfs(8). See initramfs.conf(5). # 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. # by config files in the /etc/initramfs-tools/conf.d directory.
# #
@ -51,7 +51,7 @@ BOOT=local
# DEVICE: ... # DEVICE: ...
# #
# Specify a specific network interface, like eth0 # Specify a specific network interface, like eth0
# Overriden by optional ip= bootarg # Overridden by optional ip= bootarg
# #
DEVICE= DEVICE=

View file

@ -1,4 +1,5 @@
# List of modules that you want to include in your initramfs. # 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 ...] # Syntax: module_name [args ...]
# #

View file

@ -1,4 +1,4 @@
# #
# Configuration file for update-initramfs(8) # Configuration file for update-initramfs(8)
# #
@ -14,7 +14,7 @@ update_initramfs=yes
# #
# backup_initramfs [ yes | no ] # backup_initramfs [ yes | no ]
# #
# Default is yes # Default is no
# If set to no leaves no .bak backup files. # If set to no leaves no .bak backup files.
backup_initramfs=yes backup_initramfs=no

View file

@ -12,7 +12,7 @@
# command line. # command line.
# #
# DESTDIR -- The staging directory where we are building the image. # DESTDIR -- The staging directory where we are building the image.
# #
# see initramfs-tools(8) # see initramfs-tools(8)
# #

View file

@ -229,7 +229,7 @@ dep_add_modules()
# On failure fallback to /proc/mounts if readable # On failure fallback to /proc/mounts if readable
if [ -z "$root" ] && [ -r /proc/mounts ]; then 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 fi
# recheck root device # recheck root device
@ -299,12 +299,16 @@ dep_add_modules()
# md root new naming scheme /dev/md/X # md root new naming scheme /dev/md/X
elif [ "${root#/dev/md/}" != "${root}" ]; then elif [ "${root#/dev/md/}" != "${root}" ]; then
root=${root#/dev/md/} root=${root#/dev/md/}
# strip partion number
root=${root%%p[0-9]*}
# drop the partition number only for sdX and hdX devices # drop the partition number only for sdX and hdX devices
# and keep it for other devices like loop#, dm-# 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) 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 # md root /dev/mdX
elif [ "${root#/dev/md}" != "${root}" ]; then elif [ "${root#/dev/md}" != "${root}" ]; then
root=${root#/dev/md} root=${root#/dev/md}
# strip partion number
root=${root%%p[0-9]*}
# drop the partition number only for sdX and hdX devices # drop the partition number only for sdX and hdX devices
# and keep it for other devices like loop#, dm-# 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) 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="rd!c${root#/dev/rd/c}"
block=${block%%p[0-9]*} block=${block%%p[0-9]*}
# etherd device
elif [ "${root#/dev/etherd/}" != "${root}" ]; then
block=${root#/dev/etherd/*}
block="etherd!${block%p*}"
# classical root device # classical root device
else else
block=${root#/dev/} block=${root#/dev/}
@ -359,7 +367,7 @@ dep_add_modules()
sys_walk_mod_add ${root_dev_path} sys_walk_mod_add ${root_dev_path}
# catch old-style IDE # 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} sys_walk_modalias ${root_dev_path}
manual_add_modules ide-gd_mod manual_add_modules ide-gd_mod
# FIXME: remove post Squeeze # FIXME: remove post Squeeze
@ -367,7 +375,7 @@ dep_add_modules()
manual_add_modules ide-cd manual_add_modules ide-cd
fi fi
if [ -e /sys/bus/scsi/devices/ ]; then if [ -d "${DESTDIR}/lib/modules/${version}/kernel/drivers/scsi" ]; then
manual_add_modules sd_mod manual_add_modules sd_mod
fi fi
@ -410,11 +418,6 @@ auto_add_modules()
manual_add_modules "${x}" manual_add_modules "${x}"
done done
;; ;;
kms)
for x in fbcon intel_agp radeon i915; do
manual_add_modules "${x}"
done
;;
net) net)
copy_modules_dir kernel/drivers/net \ copy_modules_dir kernel/drivers/net \
appletalk arcnet bonding can hamradio irda pcmcia \ appletalk arcnet bonding can hamradio irda pcmcia \
@ -468,7 +471,6 @@ auto_add_modules()
;; ;;
*) *)
auto_add_modules base auto_add_modules base
auto_add_modules kms
auto_add_modules net auto_add_modules net
auto_add_modules ide auto_add_modules ide
auto_add_modules scsi auto_add_modules scsi
@ -484,6 +486,20 @@ auto_add_modules()
esac 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 # mkinitramfs help message
usage() 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. Specifies the modules for the initramfs image.
The default setting is \fImost\fP. 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. \fIdep\fP tries to guess which modules are necessary for the running box.
@ -40,12 +40,12 @@ The keymap will anyway be loaded by the initscripts later, and the packages
that might need input will normally set this variable automatically, so there that might need input will normally set this variable automatically, so there
should normally be no need to set this. should normally be no need to set this.
.TP .TP
\fB COMPRESS \fB COMPRESS
Specifies the compression method used for the initramfs image. Specifies the compression method used for the initramfs image.
.B mkinitramfs .B mkinitramfs
will default to gzip if the kernel lacks support (CONFIG_RD) or the will default to gzip if the kernel lacks support (CONFIG_RD) or the
corresponding userspace utility is not present. corresponding userspace utility is not present.
.TP .TP
\fB UMASK \fB UMASK
@ -82,10 +82,6 @@ The initramfs-tools are written by Maximilian Attems <maks@debian.org>,
Jeff Bailey <jbailey@raspberryginger.com> and numerous others. Jeff Bailey <jbailey@raspberryginger.com> and numerous others.
Loosely based on mkinitrd.conf by Herbert Xu. 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 .SH SEE ALSO
.BR .BR
.IR initramfs-tools (8), .IR initramfs-tools (8),

View file

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

View file

@ -2,7 +2,7 @@
_log_msg() _log_msg()
{ {
[ "$quiet" = "y" ] && return if [ "$quiet" = "y" ]; then return; fi
printf "\033[1m" printf "\033[1m"
printf "$@" printf "$@"
printf "\033[m\n" printf "\033[m\n"
@ -25,16 +25,30 @@ log_warning_msg()
log_begin_msg() log_begin_msg()
{ {
if [ -x /sbin/usplash_write ]; then
/sbin/usplash_write "TEXT $@"
fi
_log_msg "$@ ..." _log_msg "$@ ..."
} }
log_end_msg() log_end_msg()
{ {
if [ -x /sbin/usplash_write ]; then
/sbin/usplash_write "SUCCESS ok"
fi
: :
} }
panic() 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 # Disallow console access
if [ -n "${panic}" ]; then if [ -n "${panic}" ]; then
sleep ${panic} sleep ${panic}
@ -67,7 +81,7 @@ set_initlist()
# only allow variable name chars # only allow variable name chars
case ${si_x#${initdir}/} in case ${si_x#${initdir}/} in
*[![:alnum:]_.]*) *[![:alnum:]\._-]*)
[ "${verbose}" = "y" ] \ [ "${verbose}" = "y" ] \
&& echo "$si_x ignored: not alphanumeric or '_' file" && echo "$si_x ignored: not alphanumeric or '_' file"
continue continue
@ -88,7 +102,14 @@ set_initlist()
continue continue
fi 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 done
} }
@ -99,18 +120,17 @@ reduce_satisfied()
for rs_y in ${deplist}; do for rs_y in ${deplist}; do
# only allow variable name chars # only allow variable name chars
case ${rs_y} in case ${rs_y} in
*[![:alnum:]_.]*) *[![:alnum:]\._-]*)
continue continue
;; ;;
esac esac
# skip non executable scripts # skip non executable scripts
if [ ! -x ${initdir}/${rs_y} ]; then [ ! -x ${initdir}/${rs_y} ] && continue
continue
fi
# skip directories # skip directories
if [ -d ${initdir}/${rs_y} ]; then [ -d ${initdir}/${rs_y} ] && continue
continue # skip bad syntax
fi sh -n ${initdir}/${rs_y} || continue
tmpdeplist="${tmpdeplist} ${rs_y}" tmpdeplist="${tmpdeplist} ${rs_y}"
done done
deplist=${tmpdeplist} deplist=${tmpdeplist}
@ -193,18 +213,26 @@ get_prereq_pairs()
call_scripts() call_scripts()
{ {
set -e
for cs_x in ${runlist}; do for cs_x in ${runlist}; do
[ -f ${initdir}/${cs_x} ] || continue [ -f ${initdir}/${cs_x} ] || continue
# mkinitramfs verbose output # mkinitramfs verbose output
if [ "${verbose}" = "y" ]; then if [ "${verbose}" = "y" ]; then
echo "Calling hook ${cs_x}" echo "Calling hook ${cs_x}"
fi fi
${initdir}/${cs_x} ${initdir}/${cs_x} && ec=$? || ec=$?
# allow boot scripts to modify exported boot paramaters # 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 if [ -e /conf/param.conf ]; then
. /conf/param.conf . /conf/param.conf
fi fi
done done
set +e
} }
run_scripts() run_scripts()
@ -345,9 +373,9 @@ configure_networking()
# The NIC is to be configured if this file does not exist. # The NIC is to be configured if this file does not exist.
# Ip-Config tries to create this file and when it succeds # Ip-Config tries to create this file and when it succeds
# creating the file, ipconfig is not run again. # creating the file, ipconfig is not run again.
if [ -e /tmp/net-"${DEVICE}".conf ]; then for x in /tmp/net-"${DEVICE}".conf /tmp/net-*.conf ; do
break; [ -e "$x" ] && break 2
fi done
case ${IP} in case ${IP} in
none|off) 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' # Template file for 'initramfs-tools'
pkgname=initramfs-tools pkgname=initramfs-tools
_localver=0.99.8.0 # This is the XBPS version _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} version=${_localver}.${_distver}
build_style=custom-install build_style=custom-install
short_desc="Tools for generating an initramfs" 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/update-initramfs $DESTDIR/usr/sbin
install -m 755 $FILESDIR/lsinitramfs $DESTDIR/usr/sbin install -m 755 $FILESDIR/lsinitramfs $DESTDIR/usr/sbin
sed -i -e "s|@VERSION@|${version}|g" $DESTDIR/usr/sbin/update-initramfs 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
} }