diff --git a/srcpkgs/initramfs-tools/files/bash_completion.d/initramfs-tools b/srcpkgs/initramfs-tools/files/bash_completion.d/initramfs-tools new file mode 100644 index 00000000000..a52074f62a5 --- /dev/null +++ b/srcpkgs/initramfs-tools/files/bash_completion.d/initramfs-tools @@ -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 diff --git a/srcpkgs/initramfs-tools/files/conf/initramfs.conf b/srcpkgs/initramfs-tools/files/conf/initramfs.conf index 52978632c80..79f06c7df24 100644 --- a/srcpkgs/initramfs-tools/files/conf/initramfs.conf +++ b/srcpkgs/initramfs-tools/files/conf/initramfs.conf @@ -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= diff --git a/srcpkgs/initramfs-tools/files/conf/modules b/srcpkgs/initramfs-tools/files/conf/modules index 9aa46468cb5..dd9dc54e584 100644 --- a/srcpkgs/initramfs-tools/files/conf/modules +++ b/srcpkgs/initramfs-tools/files/conf/modules @@ -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 ...] # diff --git a/srcpkgs/initramfs-tools/files/conf/update-initramfs.conf b/srcpkgs/initramfs-tools/files/conf/update-initramfs.conf index c08c6edb338..31823e2632e 100644 --- a/srcpkgs/initramfs-tools/files/conf/update-initramfs.conf +++ b/srcpkgs/initramfs-tools/files/conf/update-initramfs.conf @@ -1,4 +1,4 @@ -# +# # Configuration file for update-initramfs(8) # @@ -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 diff --git a/srcpkgs/initramfs-tools/files/docs/example_hook b/srcpkgs/initramfs-tools/files/docs/example_hook index 683ddada474..1f3535278be 100644 --- a/srcpkgs/initramfs-tools/files/docs/example_hook +++ b/srcpkgs/initramfs-tools/files/docs/example_hook @@ -12,7 +12,7 @@ # command line. # # DESTDIR -- The staging directory where we are building the image. -# +# # see initramfs-tools(8) # diff --git a/srcpkgs/initramfs-tools/files/hook-functions b/srcpkgs/initramfs-tools/files/hook-functions index 2b073a49ae3..bc8d164aa4d 100644 --- a/srcpkgs/initramfs-tools/files/hook-functions +++ b/srcpkgs/initramfs-tools/files/hook-functions @@ -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' , Jeff Bailey 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 for XBPS - The X Binary -Package System. - .SH SEE ALSO .BR .IR initramfs-tools (8), diff --git a/srcpkgs/initramfs-tools/files/mkinitramfs b/srcpkgs/initramfs-tools/files/mkinitramfs index 80bff55800c..7f76c5d44fb 100755 --- a/srcpkgs/initramfs-tools/files/mkinitramfs +++ b/srcpkgs/initramfs-tools/files/mkinitramfs @@ -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 - NOEXEC=1 - fi +fs=$(df -P $DESTDIR | tail -1 | awk '{print $6}') +if [ -n "$fs" ] && mount | grep -q "on $fs .*noexec" ; then + NOEXEC=1 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" diff --git a/srcpkgs/initramfs-tools/files/scripts/functions b/srcpkgs/initramfs-tools/files/scripts/functions index 53836193318..4e284ad2559 100644 --- a/srcpkgs/initramfs-tools/files/scripts/functions +++ b/srcpkgs/initramfs-tools/files/scripts/functions @@ -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) diff --git a/srcpkgs/initramfs-tools/files/scripts/init-top/fbconsole b/srcpkgs/initramfs-tools/files/scripts/init-top/fbconsole deleted file mode 100755 index c5202df6406..00000000000 --- a/srcpkgs/initramfs-tools/files/scripts/init-top/fbconsole +++ /dev/null @@ -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 diff --git a/srcpkgs/initramfs-tools/template b/srcpkgs/initramfs-tools/template index 8021c1ca4ec..94e1f6be432 100644 --- a/srcpkgs/initramfs-tools/template +++ b/srcpkgs/initramfs-tools/template @@ -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 }