diff --git a/srcpkgs/initramfs-tools/files/conf/initramfs.conf b/srcpkgs/initramfs-tools/files/conf/initramfs.conf index cba601a9daa..52978632c80 100644 --- a/srcpkgs/initramfs-tools/files/conf/initramfs.conf +++ b/srcpkgs/initramfs-tools/files/conf/initramfs.conf @@ -28,7 +28,7 @@ MODULES=most KEYMAP=n # -# COMPRESS: [ gzip | bzip2 | lzma ] +# COMPRESS: [ gzip | bzip2 | lzma | lzop ] # COMPRESS=gzip @@ -50,10 +50,11 @@ BOOT=local # # DEVICE: ... # -# Specify the network interface, like eth0 +# Specify a specific network interface, like eth0 +# Overriden by optional ip= bootarg # -DEVICE=eth0 +DEVICE= # # NFSROOT: [ auto | HOST:MOUNT ] diff --git a/srcpkgs/initramfs-tools/files/hook-functions b/srcpkgs/initramfs-tools/files/hook-functions index 2596d4dec5f..180fcc124d3 100644 --- a/srcpkgs/initramfs-tools/files/hook-functions +++ b/srcpkgs/initramfs-tools/files/hook-functions @@ -42,27 +42,23 @@ add_modules_from_file() # Add dependent modules + eventual firmware manual_add_modules() { - local mam_x firmwares firmware + local kmod firmware - for mam_x in $(modprobe --set-version="${version}" --ignore-install \ + for kmod in $(modprobe --set-version="${version}" --ignore-install \ --quiet --show-depends "${1}" | awk '/^insmod/ { print $2 }'); do # Prune duplicates - if [ -e "${DESTDIR}/${mam_x}" ]; then + if [ -e "${DESTDIR}/${kmod}" ]; then continue fi - mkdir -p "${DESTDIR}/$(dirname "${mam_x}")" - ln -s "${mam_x}" "${DESTDIR}/$(dirname "${mam_x}")" + mkdir -p "${DESTDIR}/$(dirname "${kmod}")" + ln -s "${kmod}" "${DESTDIR}/$(dirname "${kmod}")" if [ "${verbose}" = "y" ]; then - echo "Adding module ${mam_x}" + echo "Adding module ${kmod}" fi - # Add firmware files if necessary - firmwares=$(modinfo -F firmware "${mam_x}") - if [ -z "${firmwares}" ]; then - continue - fi - for firmware in $firmwares; do + # Add required firmware + for firmware in $(modinfo -F firmware "${kmod}"); do if [ -e "${DESTDIR}/lib/firmware/${firmware}" ] \ || [ -e "${DESTDIR}/lib/firmware/${version}/${firmware}" ]; then continue @@ -77,11 +73,11 @@ manual_add_modules() if [ ! -e /proc/modules ] ; then continue fi - if grep -q "^$(basename "${mam_x}" .ko)[[:space:]]" \ + if grep -q "^$(basename "${kmod}" .ko)[[:space:]]" \ /proc/modules \ - || grep -q "^$(basename "${mam_x}" .ko)" \ + || grep -q "^$(basename "${kmod}" .ko)" \ "${CONFDIR}/modules"; then - echo "W: Possible missing firmware /lib/firmware/${firmware} for module $(basename ${mam_x} .ko)" >&2 + echo "W: Possible missing firmware /lib/firmware/${firmware} for module $(basename ${kmod} .ko)" >&2 fi continue fi @@ -103,59 +99,33 @@ manual_add_modules() done } -# $1 is the source path (e.g. /usr/bin/time) -# $2 is the relative destination (e.g. /usr or /usr/time) -# -# The destination is interpreted in the same way "cp" would, meaning -# (assuming /bin is a directory): -# -# "copy_exec /usr/bin/time /bin" -> /bin/time -# "copy_exec /usr/bin/time /bin/mytime" -> /bin/mytime -# -# If $2 is left out, the same destination path as for the source arg will -# be used and directories will be created as needed, so: -# -# "copy_exec /usr/bin/time" -> /usr/bin/time -# +# $1 = file to copy to ramdisk +# $2 (optional) Name for the file on the ramdisk +# Location of the image dir is assumed to be $DESTDIR +# We never overwrite the target if it exists. copy_exec() { - local source target destination final_destination x nonoptlib + local src target x nonoptlib local libname dirname - source="${1}" - if [ -n "${2}" ]; then - target="${2}" - else - if [ ! -e "${DESTDIR}/$(dirname "${1}")" ]; then - mkdir -p "${DESTDIR}/$(dirname "${1}")" - fi - target="${1}" - fi + src="${1}" + target="${2:-$1}" + + [ -f "${src}" ] || return 1 if [ -d "${DESTDIR}/${target}" ]; then - destination="${target}/$(basename "${source}")" + # check if already copied + [ -e "${DESTDIR}/$target/${src##*/}" ] && return 0 else - destination="${target}" + [ -e "${DESTDIR}/$target" ] && return 0 + #FIXME: inst_dir + mkdir -p "${DESTDIR}/${target%/*}" fi - final_destination="${DESTDIR}/${destination}" - if [ -L "$final_destination" ]; then - if [ $(readlink "${final_destination}") != "${source}" ]; then - echo "W:copy_exec: Not copying ${source} to \$DESTDIR${destination}, which is already a copy of $(readlink ${final_destination})" >&2 - return - fi - else - ln -s ${source} ${DESTDIR}/${destination} - if [ "${verbose}" = "y" ]; then - echo "Adding binary ${source}" - fi - fi + [ "${verbose}" = "y" ] && echo "Adding binary ${src}" + ln -s "${src}" "${DESTDIR}/${target}" # Copy the dependant libraries - if ! command -v ldd >/dev/null 2>&1 ; then - echo "WARNING: no ldd around - install glibc package." - exit 1 - fi - for x in $(ldd ${source} 2>/dev/null | sed -e ' + for x in $(ldd ${src} 2>/dev/null | sed -e ' /\//!d; /linux-gate/d; /=>/ {s/.*=>[[:blank:]]*\([^[:blank:]]*\).*/\1/}; @@ -173,12 +143,11 @@ copy_exec() { libname=$(basename "${x}") dirname=$(dirname "${x}") + # FIXME inst_lib mkdir -p "${DESTDIR}/${dirname}" if [ ! -e "${DESTDIR}/${dirname}/${libname}" ]; then ln -s "${x}" "${DESTDIR}/${dirname}" - if [ "${verbose}" = "y" ]; then - echo "Adding library ${x}" - fi + [ "${verbose}" = "y" ] && echo "Adding library ${x}" fi done } @@ -186,8 +155,7 @@ copy_exec() { # Copy entire subtrees to the initramfs copy_modules_dir() { - local x_mod - local exclude + local kmod exclude local dir="$1" shift @@ -197,15 +165,15 @@ copy_modules_dir() if [ "${verbose}" = "y" ]; then echo "Copying module directory ${dir}" if [ $# -ge 1 ]; then - echo "(excluding $*)" + echo "(excluding $*)" fi fi while [ $# -ge 1 ]; do - exclude="$exclude -name $1 -prune -o " + exclude="${exclude:-} -name $1 -prune -o " shift done - for x_mod in $(find "${MODULESDIR}/${dir}" ${exclude} -name '*.ko' -print); do - manual_add_modules $(basename ${x_mod} .ko) + for kmod in $(find "${MODULESDIR}/${dir}" ${exclude:-} -name '*.ko' -print); do + manual_add_modules $(basename ${kmod} .ko) done } @@ -338,6 +306,12 @@ dep_add_modules() elif [ "${root#/dev/mmcblk}" != "${root}" ]; then block=${root#/dev/} block=${block%%p[0-9]*} + + # DAC960 - good old mylex raid - root dev format /dev/rd/cXdXpX + elif [ "${root#/dev/rd/c}" != "${root}" ]; then + block="rd!c${root#/dev/rd/c}" + block=${block%%p[0-9]*} + # classical root device else block=${root#/dev/} @@ -395,11 +369,12 @@ dep_add_modules() # The modules "most" classes added per default to the initramfs auto_add_modules() { - case "$1" in + case "${1:-}" in base) - for x in ehci-hcd ohci-hcd uhci-hcd usbhid btrfs ext2 \ - ext3 ext4 ext4dev isofs jfs nfs reiserfs udf xfs af_packet \ - atkbd i8042 virtio_pci; do + for x in ehci-hcd ohci-hcd uhci-hcd usbhid xhci hid-apple \ + hid-microsoft \ + btrfs ext2 ext3 ext4 ext4dev isofs jfs nfs reiserfs udf xfs \ + af_packet atkbd i8042 virtio_pci; do manual_add_modules "${x}" done ;; @@ -525,8 +500,8 @@ check_minkver() { local curversion initdir ARCH minversion cm_x tmp - curversion="${1}" - initdir="${2}" + curversion="${1:-}" + initdir="${2:-}" if [ -z "${initdir}" ]; then ARCH=$(uname -m) case ${ARCH} in @@ -545,7 +520,7 @@ check_minkver() return 0 fi set_initlist - for cm_x in ${initlist}; do + for cm_x in ${initlist:-}; do # sed: keep last line starting with MINKVER=, # remove MINKVER= and trailing space minver=$(sed '/^MINKVER=/!d;$!d;s/^MINKVER=//;s/[[:space:]]*$//' "${initdir}/${cm_x}") diff --git a/srcpkgs/initramfs-tools/files/init b/srcpkgs/initramfs-tools/files/init index 037e43d5bc4..2fabbc707d7 100755 --- a/srcpkgs/initramfs-tools/files/init +++ b/srcpkgs/initramfs-tools/files/init @@ -190,6 +190,9 @@ for x in $(cat /proc/cmdline); do netconsole=*) netconsole=${x#netconsole=} ;; + BOOTIF=*) + BOOTIF=${x#BOOTIF=} + ;; esac done diff --git a/srcpkgs/initramfs-tools/files/initramfs-tools.8 b/srcpkgs/initramfs-tools/files/initramfs-tools.8 index 3bd5f12804e..0a1557462e1 100644 --- a/srcpkgs/initramfs-tools/files/initramfs-tools.8 +++ b/srcpkgs/initramfs-tools/files/initramfs-tools.8 @@ -1,4 +1,4 @@ -.TH INITRAMFS-TOOLS 8 "2010/04/05" "Linux" "mkinitramfs script overview" +.TH INITRAMFS-TOOLS 8 "2010/04/10" "Linux" "mkinitramfs script overview" .SH NAME initramfs-tools \- an introduction to writing scripts for mkinitramfs @@ -69,8 +69,10 @@ NFS server than the DHCP server. See Documentation/filesystems/nfsroot.txt in any recent Linux source for details. Optional paramater for NFS root. .TP -\fB\fI cryptopts -passes the args for cryptoroot. Set by the cryptsetup boot hooks. +\fB\fI BOOTIF +is a mac adress in pxelinux format with leading "01-" and "-" as separations. +pxelinux passes mac adress of network card used to PXE boot on with this +bootarg. .TP \fB\fI boot @@ -295,7 +297,9 @@ esac Where PREREQ is modified to list other scripts in the same subdirectory if necessary. .SS Help functions -A number of functions (mostly dealing with output) are provided to boot scripts: +A number of functions (mostly dealing with output) are provided to boot scripts in +.I /scripts/functions +: .TP \fB\fI @@ -469,7 +473,7 @@ prereqs) ;; esac -\fR. /usr/share/initramfs-tools/hook-functions +\fR. /scripts/functions # Begin real processing below this line if [ ! \-x "/sbin/frobnicate" ]; then panic "Frobnication executable not found" diff --git a/srcpkgs/initramfs-tools/files/mkinitramfs b/srcpkgs/initramfs-tools/files/mkinitramfs index 400cc568ac3..96d5c7f81d4 100755 --- a/srcpkgs/initramfs-tools/files/mkinitramfs +++ b/srcpkgs/initramfs-tools/files/mkinitramfs @@ -64,7 +64,7 @@ done . "${CONFDIR}/initramfs.conf" EXTRA_CONF='' for i in /usr/share/initramfs-tools/conf.d/* ${CONFDIR}/conf.d/*; do - EXTRA_CONF="${EXTRA_CONF} $(basename $i \ + [ -e $i ] && EXTRA_CONF="${EXTRA_CONF} $(basename $i \ | grep '^[[:alnum:]][[:alnum:]\._-]*$' | grep -v '\.dpkg-.*$')"; done # FIXME: deprecated those settings on mkinitramfs run @@ -84,7 +84,7 @@ for i in /usr/share/initramfs-tools/conf-hooks.d/*; do fi done -if [ -n "${UMASK}" ]; then +if [ -n "${UMASK:-}" ]; then umask "${UMASK}" fi @@ -126,7 +126,7 @@ case "${version}" in esac # Check userspace and kernel support for compressed initramfs images -if [ -z "${compress}" ]; then +if [ -z "${compress:-}" ]; then compress=${COMPRESS} else COMPRESS=${compress} @@ -146,6 +146,9 @@ if [ -r /boot/config-${version} ]; then fi fi +# Always use max compression. +compress="${compress} -9" + if [ -d "${outfile}" ]; then echo "${outfile} is a directory" exit 1 @@ -161,9 +164,9 @@ if [ ! -e "${MODULESDIR}/modules.dep" ]; then depmod ${version} fi -DESTDIR="$(mktemp -t -d mkinitramfs_XXXXXX)" || exit 1 +DESTDIR="$(mktemp -d ${TMPDIR:-/tmp}/mkinitramfs_XXXXXX)" || exit 1 chmod 755 "${DESTDIR}" -__TMPCPIOGZ="$(mktemp -t mkinitramfs-OL_XXXXXX)" || exit 1 +__TMPCPIOGZ="$(mktemp ${TMPDIR:-/tmp}/mkinitramfs-OL_XXXXXX)" || exit 1 DPKG_ARCH=`uname -m` @@ -250,7 +253,7 @@ for i in ${EXTRA_CONF}; do done # ROOT hardcoding -if [ -n "${ROOT}" ]; then +if [ -n "${ROOT:-}" ]; then echo "ROOT=${ROOT}" > ${DESTDIR}/conf/conf.d/root fi @@ -275,8 +278,9 @@ if [ -e "${CONFDIR}/DSDT.aml" ]; then fi # Remove any looping or broken symbolic links, since they break cpio. +[ "${verbose}" = y ] && xargs_verbose="-t" find "${DESTDIR}" -type l -printf '%p %Y\n' | sed -n 's/ [LN]$//p' \ - | xargs -rL1 rm -f + | xargs ${xargs_verbose:-} -rL1 rm -f # Copy resume from klibc copy_exec /bin/resume /bin diff --git a/srcpkgs/initramfs-tools/files/mkinitramfs.8 b/srcpkgs/initramfs-tools/files/mkinitramfs.8 index 7fdeefb4e52..49db6c82f84 100644 --- a/srcpkgs/initramfs-tools/files/mkinitramfs.8 +++ b/srcpkgs/initramfs-tools/files/mkinitramfs.8 @@ -1,4 +1,4 @@ -.TH MKINITRAMFS 8 "2010/04/04" "Linux" "mkinitramfs manual" +.TH MKINITRAMFS 8 "2010/04/07" "Linux" "mkinitramfs manual" .SH NAME mkinitramfs \- low-level tool for generating an initramfs image @@ -92,6 +92,19 @@ This option queries if mkinitramfs can create ramdisks on a running kernel of ve This option queries if mkinitramfs can create ramdisks for kernel version .IR tversion . +.SH ENVIRONMENT +.B mkinitramfs +honours the +.B TMPDIR +environment variable. If set, it uses subdirectories in the given +directory to create its temporary working directories. Else it uses +.I /tmp +as default value for that purpose. The given directory should be on a +filesystem which allows the execution of files stored there, i.e. +should not be mounted with the +.B noexec +mount option. + .SH FILES .TP .I /etc/initramfs-tools/initramfs.conf diff --git a/srcpkgs/initramfs-tools/files/scripts/functions b/srcpkgs/initramfs-tools/files/scripts/functions index b11ee63a9da..53836193318 100644 --- a/srcpkgs/initramfs-tools/files/scripts/functions +++ b/srcpkgs/initramfs-tools/files/scripts/functions @@ -182,7 +182,7 @@ reduce_prereqs() get_prereq_pairs() { set_initlist - for gp_x in ${initlist}; do + for gp_x in ${initlist:-}; do echo ${gp_x} ${gp_x} prereqs=$(${initdir}/${gp_x} prereqs) for prereq in ${prereqs}; do @@ -216,7 +216,7 @@ run_scripts() . ${initdir}/ORDER elif command -v tsort >/dev/null 2>&1; then runlist=$(get_prereq_pairs | tsort) - call_scripts $2 + call_scripts ${2:-} else get_prereqs reduce_prereqs @@ -315,7 +315,7 @@ configure_networking() if [ -z "$bootif_mac" ]; then bootif_mac="$x" else - bootif_mac="$x:$bootif_mac" + bootif_mac="$bootif_mac:$x" fi done unset IFS @@ -355,10 +355,10 @@ configure_networking() ;; ""|on|any) # Bring up device - ipconfig -t ${ROUNDTTT} ${DEVICE} + ipconfig -t ${ROUNDTTT} "${DEVICE}" ;; dhcp|bootp|rarp|both) - ipconfig -t ${ROUNDTTT} -c ${IP} -d ${DEVICE} + ipconfig -t ${ROUNDTTT} -c ${IP} -d "${DEVICE}" ;; *) ipconfig -t ${ROUNDTTT} -d $IP @@ -383,7 +383,8 @@ configure_networking() # source specific bootdevice . /tmp/net-${DEVICE}.conf else - # source any interface as not exaclty specified + # source any interface... + # ipconfig should have quit after first response . /tmp/net-*.conf fi } diff --git a/srcpkgs/initramfs-tools/files/update-initramfs b/srcpkgs/initramfs-tools/files/update-initramfs index 9b8d82dd992..4d1c42460a2 100755 --- a/srcpkgs/initramfs-tools/files/update-initramfs +++ b/srcpkgs/initramfs-tools/files/update-initramfs @@ -11,8 +11,8 @@ version="" usage() { - if [ -n "${1}" ]; then - printf "${@}\n\n" >&2 + if [ -n "${1:-}" ]; then + printf "${*}\n\n" >&2 fi cat >&2 << EOF Usage: ${0} [OPTION]... @@ -48,16 +48,16 @@ chrooted() mild_panic() { - if [ -n "${1}" ]; then - printf "${@}\n" >&2 + if [ -n "${1:-}" ]; then + printf "${*}\n" >&2 fi exit 0 } panic() { - if [ -n "${1}" ]; then - printf "${@}\n" >&2 + if [ -n "${1:-}" ]; then + printf "${*}\n" >&2 fi exit 1 } @@ -65,7 +65,7 @@ panic() verbose() { if [ "${verbose}" = 1 ]; then - printf "${@}\n" + printf "${*}\n" fi } @@ -114,6 +114,7 @@ backup_booted_initramfs() fi # keep booted initramfs + boot_initramfs= uptime_days=$(awk '{printf "%d", $1 / 3600 / 24}' /proc/uptime) if [ -n "$uptime_days" ]; then boot_initramfs=$(find "${initramfs}.bak" -mtime +${uptime_days}) @@ -256,6 +257,7 @@ set_current_version() set_linked_version() { + linktarget= if [ -e /initrd.img ] && [ -L /initrd.img ]; then linktarget="$(basename "$(readlink /initrd.img)")" fi @@ -274,6 +276,10 @@ set_linked_version() set_highest_version() { get_sorted_versions + if [ -z "${version_list}" ]; then + version= + return + fi set -- ${version_list} version=${1} } diff --git a/srcpkgs/initramfs-tools/template b/srcpkgs/initramfs-tools/template index a91a183b3f0..ad130b604f3 100644 --- a/srcpkgs/initramfs-tools/template +++ b/srcpkgs/initramfs-tools/template @@ -1,6 +1,6 @@ # Template file for 'initramfs-tools' pkgname=initramfs-tools -version=0.99.2.debian0.94.4 +version=0.99.3.debian0.95.1 build_style=custom-install short_desc="Tools for generating an initramfs" maintainer="Juan RP "