[arch-projects] [mkinitcpio][PATCH 00/26] patchbomb (maybe some bug fixes)
I'd like to get a mkinitcpio release out the door in the next few weeks, but first we need actual patches to do that, so... here we go. The majority of this is style tweaks and bug fixes, but there are a few small new features I'll point out: 1) Allowing soft failures on modules -- if a module ends with a '?' character and the module isn't found, this won't trigger an error. Folks building custom kernel and building in modules like ext4 or sd_mod will find this useful. 2) busybox is installed during the build process rather than doing the install at bootstrap. Tom and I thought this made sense since the initcpio should be a "build once, use many" sort of scenario. Do the repetitive work up front where feasible. 3) Allow the 'break' variable on the cmdline to provide a pre or post-mount shell prompt. The behavior of 'break' or 'break=y' remains untouched. 4) Better support for keymap/consolefont in non-sysvinit environments. This stems from FS#24685. Basically, I went with a middle ground and we now source /etc/rc.conf in these hooks which means a systemd user can simple source /etc/vconsole.conf, /etc/locale.conf and then remap the variables to the names expected under normal circumstances. sysvinit users should notice absolutely no change in behavior here. I'll be testing this throughout the week as I have time, but anyone who has feedback or wants to mention that I broke everything is more than welcome to. Easiest way to get all of this is pull from my 'for-thomas' branch on github: git://github.com/falconindy/mkinitcpio.git cheers! d Dave Reisner (25): install/consolefont: cleanup and refactor keymap/consolefont: source rc.conf properly from $BASEDIR keymap: simplify unicode detection cleanup and bashify install hooks base: remove superfluous leading / functions: allow ignoring errors on module addition functions: refactor get_{base,dir}name functions: perform path lookup for binaries if needed functions: specify the delimiter to xargs ensure local scoping of variables mkinitcpio: simplify setting of SKIPHOOKS mkinitcpio: fix whitespace errors in error messages mkinitcpio: explicitly create $BUILDROOT mkinitcpio: keep going even when a hook isn't found mkinitcpio: insist that /dev be mounted init: support breaks before and after mounting root init: allow /run to be mounted with exec perms init: extend PATH to include /usr/local bins init: pass PATH to real PID 1's environment setup busybox during image creation instead of runtime lsinitcpio: disable color when stdout isn't a tty lsinitcpio: follow symlinks only when necessary functions: fix output order in _add_symlink use correct variable to reference compression method init_functions: use constants on LHS of tests Florian Pritz (1): harden version generation Makefile | 7 ++- PKGBUILD | 4 +- functions | 77 ++++++++++++++++----- hooks/keymap | 11 +-- init | 19 +++--- init_functions | 6 +- install/base | 7 ++- install/btrfs | 15 ++-- install/consolefont | 56 ++++++++------- install/dsdt | 21 ++---- install/filesystems | 2 +- install/fw | 29 +++----- install/ide | 30 +++----- install/keymap | 24 ++++--- install/memdisk | 19 +++--- install/net | 195 +++++++++++++++++++++++++-------------------------- install/pata | 4 +- install/pcmcia | 29 ++++---- install/resume | 19 ++--- install/sata | 4 +- install/scsi | 4 +- install/sleep | 27 +++---- install/udev | 33 ++++----- install/usb | 32 ++++----- install/usbinput | 30 +++----- lsinitcpio | 8 ++- mkinitcpio | 26 ++++--- 27 files changed, 373 insertions(+), 365 deletions(-) -- 1.7.6.4
* Provide support for uncompressed font files as well as compressed * Avoiding using an unnecessary temp file * Support $BASEDIR * Warn when no font is found * Only add the runtime hook if a font is added Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- install/consolefont | 52 ++++++++++++++++++++++++++------------------------ 1 files changed, 27 insertions(+), 25 deletions(-) diff --git a/install/consolefont b/install/consolefont index 395387b..271fc2f 100644 --- a/install/consolefont +++ b/install/consolefont @@ -1,32 +1,34 @@ -# vim: set ft=sh: +#!/bin/bash + +build() { + local file ext -build() -{ - MODULES="" - BINARIES="" - FILES="" - SCRIPT="consolefont" eval "$(grep -e "^CONSOLEFONT=" /etc/rc.conf)" - if [ -n "$CONSOLEFONT" ]; then - if [ -e /usr/share/kbd/consolefonts/$CONSOLEFONT.psfu.gz ]; then - CONSOLEFONT_FILE_GZ="/usr/share/kbd/consolefonts/$CONSOLEFONT.psfu.gz" - CONSOLEFONT_FILE="$(mktemp ${TMPDIR}/consolefont.psfu.XXXXXX)" - zcat ${CONSOLEFONT_FILE_GZ} > ${CONSOLEFONT_FILE} - add_file ${CONSOLEFONT_FILE} /consolefont.psfu - elif [ -e /usr/share/kbd/consolefonts/$CONSOLEFONT.psf.gz ]; then - CONSOLEFONT_FILE_GZ="/usr/share/kbd/consolefonts/$CONSOLEFONT.psf.gz" - CONSOLEFONT_FILE="$(mktemp ${TMPDIR}/consolefont.psf.XXXXXX)" - zcat ${CONSOLEFONT_FILE_GZ} > ${CONSOLEFONT_FILE} - add_file ${CONSOLEFONT_FILE} /consolefont.psf - else - echo "consolefont: Font file does not exist or does not end with .psf.gz or .psfu.gz." - fi + if [[ -n "$CONSOLEFONT" ]]; then + for file in "$BASEDIR/usr/share/kbd/consolefonts/$CONSOLEFONT".psf?(u)?(.gz); do + if [[ -e $file ]]; then + [[ $file =~ \.(psfu?)(\.gz)?$ ]] && ext=${BASH_REMATCH[1]} + if [[ $file = *.gz ]]; then + gzip -cd "$file" > "$BUILDROOT/consolefont.$ext" + else + add_file "${file#$BASEDIR}" "/consolefont.$ext" + fi + SCRIPT=consolefont + return 0 + fi + done + error "consolefont: requested font not found: \`%s'" "$CONSOLEFONT" + return 1 + else + warning "consolefont: no font found in %s/etc/rc.conf" "${BASEDIR%/}" + return 1 fi } -help () -{ -cat<<HELPEOF - This hook loads consolefont specified in rc.conf during early userspace. +help() { + cat <<HELPEOF +This hook loads consolefont specified in rc.conf during early userspace. HELPEOF } + +# vim: set ft=sh ts=4 sw=4 et: -- 1.7.6.4
This is partially in response to FS#24685, which should hopefully cut back on configuration duplication on non-sysvinit systems. This does, however, also fix a bug with keymap/consolefont pulling the wrong rc.conf when BASEDIR is not '/' or unset. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- install/consolefont | 42 +++++++++++++++++++++++------------------- install/keymap | 24 ++++++++++++++---------- 2 files changed, 37 insertions(+), 29 deletions(-) diff --git a/install/consolefont b/install/consolefont index 271fc2f..7110c3c 100644 --- a/install/consolefont +++ b/install/consolefont @@ -3,26 +3,30 @@ build() { local file ext - eval "$(grep -e "^CONSOLEFONT=" /etc/rc.conf)" - if [[ -n "$CONSOLEFONT" ]]; then - for file in "$BASEDIR/usr/share/kbd/consolefonts/$CONSOLEFONT".psf?(u)?(.gz); do - if [[ -e $file ]]; then - [[ $file =~ \.(psfu?)(\.gz)?$ ]] && ext=${BASH_REMATCH[1]} - if [[ $file = *.gz ]]; then - gzip -cd "$file" > "$BUILDROOT/consolefont.$ext" - else - add_file "${file#$BASEDIR}" "/consolefont.$ext" + # subshell to avoid namespace pollution + ( + . "$BASEDIR/etc/rc.conf" + if [[ -n "$CONSOLEFONT" ]]; then + for file in "$BASEDIR/usr/share/kbd/consolefonts/$CONSOLEFONT".psf?(u)?(.gz); do + if [[ -e $file ]]; then + [[ $file =~ \.(psfu?)(\.gz)?$ ]] && ext=${BASH_REMATCH[1]} + if [[ $file = *.gz ]]; then + gzip -cd "$file" > "$BUILDROOT/consolefont.$ext" + else + add_file "${file#$BASEDIR}" "/consolefont.$ext" + fi + exit 0 fi - SCRIPT=consolefont - return 0 - fi - done - error "consolefont: requested font not found: \`%s'" "$CONSOLEFONT" - return 1 - else - warning "consolefont: no font found in %s/etc/rc.conf" "${BASEDIR%/}" - return 1 - fi + done + error "consolefont: requested font not found: \`%s'" "$CONSOLEFONT" + exit 1 + else + warning "consolefont: no font found in %s/etc/rc.conf" "${BASEDIR%/}" + exit 1 + fi + ) + + (( $? == 0 )) && SCRIPT=consolefont } help() { diff --git a/install/keymap b/install/keymap index 34b744a..2cf4d15 100644 --- a/install/keymap +++ b/install/keymap @@ -1,18 +1,22 @@ #!/bin/bash build() { - SCRIPT=keymap - eval "$(grep -E "^(LOCALE|KEYMAP)=" /etc/rc.conf)" - if [[ $KEYMAP ]]; then - if [[ $LOCALE = *[Uu][Tt][Ff]-8 ]]; then - printf '%s\n' "UTF8=yes" > "$BUILDROOT/keymap.utf8" - /bin/loadkeys -q -u $KEYMAP -b > "$BUILDROOT/keymap.bin" - else - printf '%s\n' "UTF8=no" > "$BUILDROOT/keymap.utf8" - /bin/loadkeys -q $KEYMAP -b > "$BUILDROOT/keymap.bin" + # subshell to avoid namespace pollution + ( + . "$BASEDIR/etc/rc.conf" + if [[ $KEYMAP ]]; then + if [[ $LOCALE = *[Uu][Tt][Ff]-8 ]]; then + printf '%s\n' "UTF8=yes" > "$BUILDROOT/keymap.utf8" + /bin/loadkeys -q -u $KEYMAP -b > "$BUILDROOT/keymap.bin" + else + printf '%s\n' "UTF8=no" > "$BUILDROOT/keymap.utf8" + /bin/loadkeys -q $KEYMAP -b > "$BUILDROOT/keymap.bin" + fi fi - fi + ) + + (( $? == 0 )) && SCRIPT=keymap } help() { -- 1.7.6.4
On Tue, Sep 27, 2011 at 3:22 AM, Dave Reisner <d@falconindy.com> wrote:
This is partially in response to FS#24685, which should hopefully cut back on configuration duplication on non-sysvinit systems. This does, however, also fix a bug with keymap/consolefont pulling the wrong rc.conf when BASEDIR is not '/' or unset.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Looks much nicer to me now, regardless of the FS you mentioned. Acked-by: Tom Gundersen <teg@jklm.no>
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- hooks/keymap | 11 +++-------- install/keymap | 8 +++----- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/hooks/keymap b/hooks/keymap index 3593168..14f20a1 100644 --- a/hooks/keymap +++ b/hooks/keymap @@ -3,14 +3,9 @@ run_hook () { if [ -e /keymap.bin ]; then msg -n ":: Loading keymap..." - . /keymap.utf8 - if [ "${UTF8}" = "yes" ]; then - kbd_mode -u -C /dev/console - printf "\033%%G" >> /dev/console - else - kbd_mode -a -C /dev/console - printf "\033%%@" >> /dev/console - fi + [ -f /keymap.utf8 ] && mode=-u || mode=-a + kbd_mode $mode -C /dev/console + printf "\033%%G" >> /dev/console loadkmap < /keymap.bin msg "done." fi diff --git a/install/keymap b/install/keymap index 2cf4d15..2880f15 100644 --- a/install/keymap +++ b/install/keymap @@ -7,12 +7,10 @@ build() { . "$BASEDIR/etc/rc.conf" if [[ $KEYMAP ]]; then if [[ $LOCALE = *[Uu][Tt][Ff]-8 ]]; then - printf '%s\n' "UTF8=yes" > "$BUILDROOT/keymap.utf8" - /bin/loadkeys -q -u $KEYMAP -b > "$BUILDROOT/keymap.bin" - else - printf '%s\n' "UTF8=no" > "$BUILDROOT/keymap.utf8" - /bin/loadkeys -q $KEYMAP -b > "$BUILDROOT/keymap.bin" + touch "$BUILDROOT/keymap.utf8" + uc=-u fi + /bin/loadkeys -q $uc $KEYMAP -b > "$BUILDROOT/keymap.bin" fi ) -- 1.7.6.4
On Tue, Sep 27, 2011 at 3:22 AM, Dave Reisner <d@falconindy.com> wrote:
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- hooks/keymap | 11 +++-------- install/keymap | 8 +++----- 2 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/hooks/keymap b/hooks/keymap index 3593168..14f20a1 100644 --- a/hooks/keymap +++ b/hooks/keymap @@ -3,14 +3,9 @@ run_hook () { if [ -e /keymap.bin ]; then msg -n ":: Loading keymap..." - . /keymap.utf8 - if [ "${UTF8}" = "yes" ]; then - kbd_mode -u -C /dev/console - printf "\033%%G" >> /dev/console - else - kbd_mode -a -C /dev/console - printf "\033%%@" >> /dev/console - fi + [ -f /keymap.utf8 ] && mode=-u || mode=-a + kbd_mode $mode -C /dev/console + printf "\033%%G" >> /dev/console
Why is this unconditional now? Should it not be %%@ in the non-unicode case? If not please explain in the commit message.
loadkmap < /keymap.bin msg "done." fi diff --git a/install/keymap b/install/keymap index 2cf4d15..2880f15 100644 --- a/install/keymap +++ b/install/keymap @@ -7,12 +7,10 @@ build() { . "$BASEDIR/etc/rc.conf" if [[ $KEYMAP ]]; then if [[ $LOCALE = *[Uu][Tt][Ff]-8 ]]; then - printf '%s\n' "UTF8=yes" > "$BUILDROOT/keymap.utf8" - /bin/loadkeys -q -u $KEYMAP -b > "$BUILDROOT/keymap.bin" - else - printf '%s\n' "UTF8=no" > "$BUILDROOT/keymap.utf8" - /bin/loadkeys -q $KEYMAP -b > "$BUILDROOT/keymap.bin" + touch "$BUILDROOT/keymap.utf8" + uc=-u fi + /bin/loadkeys -q $uc $KEYMAP -b > "$BUILDROOT/keymap.bin" fi )
-- 1.7.6.4
On Tue, Sep 27, 2011 at 11:31:53AM +0200, Tom Gundersen wrote:
On Tue, Sep 27, 2011 at 3:22 AM, Dave Reisner <d@falconindy.com> wrote:
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- hooks/keymap | 11 +++-------- install/keymap | 8 +++----- 2 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/hooks/keymap b/hooks/keymap index 3593168..14f20a1 100644 --- a/hooks/keymap +++ b/hooks/keymap @@ -3,14 +3,9 @@ run_hook () { if [ -e /keymap.bin ]; then msg -n ":: Loading keymap..." - . /keymap.utf8 - if [ "${UTF8}" = "yes" ]; then - kbd_mode -u -C /dev/console - printf "\033%%G" >> /dev/console - else - kbd_mode -a -C /dev/console - printf "\033%%@" >> /dev/console - fi + [ -f /keymap.utf8 ] && mode=-u || mode=-a + kbd_mode $mode -C /dev/console + printf "\033%%G" >> /dev/console
Why is this unconditional now? Should it not be %%@ in the non-unicode case? If not please explain in the commit message.
Not intentional -- too greedy on the refactor. Thanks for the catch. d
loadkmap < /keymap.bin msg "done." fi diff --git a/install/keymap b/install/keymap index 2cf4d15..2880f15 100644 --- a/install/keymap +++ b/install/keymap @@ -7,12 +7,10 @@ build() { . "$BASEDIR/etc/rc.conf" if [[ $KEYMAP ]]; then if [[ $LOCALE = *[Uu][Tt][Ff]-8 ]]; then - printf '%s\n' "UTF8=yes" > "$BUILDROOT/keymap.utf8" - /bin/loadkeys -q -u $KEYMAP -b > "$BUILDROOT/keymap.bin" - else - printf '%s\n' "UTF8=no" > "$BUILDROOT/keymap.utf8" - /bin/loadkeys -q $KEYMAP -b > "$BUILDROOT/keymap.bin" + touch "$BUILDROOT/keymap.utf8" + uc=-u fi + /bin/loadkeys -q $uc $KEYMAP -b > "$BUILDROOT/keymap.bin" fi )
-- 1.7.6.4
This introduces no logical code changes -- this is purely a syntactical cleanup and standardization across the build hooks. All hooks get the same treatment, adhering to the following style: #!/bin/bash build() { COMMANDS } help() { cat <<HELPEOF This is a help message. HELPEOF } # vim: set ft=sh ts=4 sw=4 et: Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- install/btrfs | 15 ++-- install/dsdt | 21 ++---- install/filesystems | 2 +- install/fw | 29 +++----- install/ide | 30 +++----- install/keymap | 2 +- install/memdisk | 19 +++--- install/net | 195 +++++++++++++++++++++++++-------------------------- install/pata | 2 +- install/pcmcia | 28 ++++---- install/resume | 19 ++--- install/sata | 2 +- install/scsi | 2 +- install/sleep | 27 +++---- install/udev | 33 ++++----- install/usb | 30 ++++----- install/usbinput | 30 +++----- 17 files changed, 220 insertions(+), 266 deletions(-) diff --git a/install/btrfs b/install/btrfs index c156bb0..60e6f5c 100644 --- a/install/btrfs +++ b/install/btrfs @@ -1,16 +1,15 @@ -# vim:set ft=sh: +#!/bin/bash -build() -{ +build() { MODULES="$(all_modules btrfs)" BINARIES="/sbin/btrfs" SCRIPT="btrfs" } -help () -{ -cat <<HELPEOF - This hook is needed to support Btrfs volumes spread - over multiple devices. +help() { + cat <<HELPEOF +This hook is needed to support Btrfs volumes spread over multiple devices. HELPEOF } + +# vim: set ft=sh ts=4 sw=4 et: diff --git a/install/dsdt b/install/dsdt index f1345d0..b38c66c 100644 --- a/install/dsdt +++ b/install/dsdt @@ -1,19 +1,14 @@ -# vim: set ft=sh: +#!/bin/bash -build() -{ - MODULES="" - BINARIES="" - FILES="" - SCRIPT="" +build() { add_file "/lib/initcpio/custom.dsdt" "DSDT.aml" } -help () -{ -cat<<HELPEOF - This hook loads a custom acpi dsdt file during boot. - Place your custom dsdt file for inclusion here: - /lib/initcpio/custom.dsdt +help() { + cat <<HELPEOF +This hook loads a custom acpi dsdt file during boot. Place your custom dsdt +file for inclusion here: /lib/initcpio/custom.dsdt HELPEOF } + +# vim: set ft=sh ts=4 sw=4 et: diff --git a/install/filesystems b/install/filesystems index 64227bc..9230b94 100644 --- a/install/filesystems +++ b/install/filesystems @@ -9,7 +9,7 @@ build() { } help() { - cat<<HELPEOF + cat <<HELPEOF This hook adds filesystems modules to the image. If you would like to minimize the modules installed in the image, add the autodetect hook too. HELPEOF diff --git a/install/fw b/install/fw index 7d7f06f..94e70d1 100644 --- a/install/fw +++ b/install/fw @@ -1,24 +1,17 @@ -# vim: set ft=sh: +#!/bin/bash -build() -{ - MODULES=" $(checked_modules "/drivers/firewire/") " +build() { + MODULES=$(checked_modules "/drivers/firewire/") - MODULES=$(echo ${MODULES}) #trim whitespace - if [ -n "${MODULES}" ]; then - MODULES="${MODULES} firewire-sbp2 sd_mod sr_mod" - fi - BINARIES="" - FILES="" - SCRIPT="" + [[ $MODULES ]] && MODULES+=" firewire-sbp2 sd_mod sr_mod" } -help () -{ -cat<<HELPEOF - This hook loads the necessary modules for a firewire root device. - Detection will take place at runtime. To minimize the modules - in the image, add the autodetect hook too. +help() { + cat <<HELPEOF +This hook loads the necessary modules for a firewire root device. Detection +will take place at runtime. To minimize the modules in the image, add the +autodetect hook too. HELPEOF } - + +# vim: set ft=sh ts=4 sw=4 et: diff --git a/install/ide b/install/ide index fa0da51..9443dd3 100644 --- a/install/ide +++ b/install/ide @@ -1,25 +1,17 @@ -# vim: set ft=sh: +#!/bin/bash -build() -{ - MODULES=" $(checked_modules "/ide/" | grep -v "legacy") "; +build() { + MODULES="$(checked_modules "/ide/" | grep -v "legacy")" - MODULES=$(echo ${MODULES}) #trim whitespace - if [ -n "${MODULES}" ]; then - MODULES="${MODULES} ide-gd_mod" - fi - - BINARIES="" - FILES="" - SCRIPT="" + [[ $MODULES ]] && MODULES+=" ide-gd_mod" } -help () -{ -cat<<HELPEOF - This hook loads the necessary modules for an ide root device, - using the old ide subsystem. - Detection will take place at runtime. To minimize the modules - in the image, add the autodetect hook too. +help() { + cat <<HELPEOF +This hook loads the necessary modules for an ide root device, using the old ide +subsystem. Detection will take place at runtime. To minimize the modules in +the image, add the autodetect hook too. HELPEOF } + +# vim: set ft=sh ts=4 sw=4 et: diff --git a/install/keymap b/install/keymap index 2880f15..1c53c4a 100644 --- a/install/keymap +++ b/install/keymap @@ -18,7 +18,7 @@ build() { } help() { - cat<<HELPEOF + cat <<HELPEOF This hook loads keymap(s) specified in rc.conf during early userspace. HELPEOF } diff --git a/install/memdisk b/install/memdisk index 69c996f..ec698fc 100644 --- a/install/memdisk +++ b/install/memdisk @@ -1,20 +1,19 @@ -# vim:set ft=sh: +#!/bin/bash -build() -{ +build() { MODULES="phram mtdblock" BINARIES="/usr/bin/memdiskfind" - FILES="" SCRIPT="memdisk" add_file /lib/initcpio/udev/01-memdisk.rules /lib/udev/rules.d/01-memdisk.rules } -help () -{ -cat <<HELPEOF - This hook detects a virtual disk created by the memdisk - tool (http://syslinux.zytor.com/wiki/index.php/MEMDISK). +help() { + cat <<HELPEOF +This hook detects a virtual disk created by the memdisk tool +(http://syslinux.zytor.com/wiki/index.php/MEMDISK). - It requires memdiskfind from syslinux 4.00 or newer. +It requires memdiskfind from syslinux 4.00 or newer. HELPEOF } + +# vim: set ft=sh ts=4 sw=4 et: diff --git a/install/net b/install/net index 2c816ba..88d0c97 100644 --- a/install/net +++ b/install/net @@ -1,109 +1,106 @@ -# vim: set ft=sh: +#!/bin/bash -build() -{ +build() { MODULES="nfs $(checked_modules "/drivers/net/") " - - BINARIES="" - FILES="" SCRIPT="net" add_binary "/lib/initcpio/ipconfig" "/bin/ipconfig" add_binary "/lib/initcpio/nfsmount" "/bin/nfsmount" } -help () -{ -cat<<HELPEOF - This hook loads the necessary modules for a network device. - Detection will take place at runtime. To minimize the modules - in the image, add the autodetect hook too. - For pcmcia net devices please use pcmcia hook too. - - Kernel Parameters: - An interface spec can be either short form, which is just the name of - an interface (eth0 or whatever), or long form. The long form consists - of up to seven elements, separated by colons: - - ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf> - nfsaddrs= is an alias to ip= and can be used too. - - <client-ip> IP address of the client. If empty, the address will - either be determined by RARP/BOOTP/DHCP. What protocol - is used de- pends on the <autoconf> parameter. If this - parameter is not empty, autoconf will be used. - - <server-ip> IP address of the NFS server. If RARP is used to - determine the client address and this parameter is NOT - empty only replies from the specified server are - accepted. To use different RARP and NFS server, - specify your RARP server here (or leave it blank), and - specify your NFS server in the 'nfsroot' parameter - (see above). If this entry is blank the address of the - server is used which answered the RARP/BOOTP/DHCP - request. - - <gw-ip> IP address of a gateway if the server is on a different - subnet. If this entry is empty no gateway is used and the - server is assumed to be on the local network, unless a - value has been received by BOOTP/DHCP. - - <netmask> Netmask for local network interface. If this is empty, - the netmask is derived from the client IP address assuming - classful addressing, unless overridden in BOOTP/DHCP reply. - - <hostname> Name of the client. If empty, the client IP address is - used in ASCII notation, or the value received by - BOOTP/DHCP. - - <device> Name of network device to use. If this is empty, all - devices are used for RARP/BOOTP/DHCP requests, and the - first one we receive a reply on is configured. If you - have only one device, you can safely leave this blank. - - <autoconf> Method to use for autoconfiguration. If this is either - 'rarp', 'bootp', or 'dhcp' the specified protocol is - used. If the value is 'both', 'all' or empty, all - protocols are used. 'off', 'static' or 'none' means - no autoconfiguration. - Examples: - ip=127.0.0.1:::::lo:none --> Enable the loopback interface. - ip=192.168.1.1:::::eth2:none --> Enable static eth2 interface. - ip=:::::eth0:dhcp --> Enable dhcp protcol for eth0 configuration. - - nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>] - - If the 'nfsroot' parameter is NOT given on the command line, the default - "/tftpboot/%s" will be used. - - <server-ip> Specifies the IP address of the NFS server. If this field - is not given, the default address as determined by the - 'ip' variable (see below) is used. One use of this - parameter is for example to allow using different servers - for RARP and NFS. Usually you can leave this blank. - - <root-dir> Name of the directory on the server to mount as root. If - there is a "%s" token in the string, the token will be - replaced by the ASCII-representation of the client's IP - address. - - <nfs-options> Standard NFS options. All options are separated by commas. - If the options field is not given, the following defaults - will be used: - port = as given by server portmap daemon - rsize = 1024 - wsize = 1024 - timeo = 7 - retrans = 3 - acregmin = 3 - acregmax = 60 - acdirmin = 30 - acdirmax = 60 - flags = hard, nointr, noposix, cto, ac - - root=/dev/nfs - - If you don't use nfsroot= parameter you need to set root=/dev/nfs - to boot from a nfs root by autoconfiguration. +help() { + cat <<HELPEOF +This hook loads the necessary modules for a network device. +Detection will take place at runtime. To minimize the modules +in the image, add the autodetect hook too. +For pcmcia net devices please use pcmcia hook too. + +Kernel Parameters: +An interface spec can be either short form, which is just the name of +an interface (eth0 or whatever), or long form. The long form consists +of up to seven elements, separated by colons: + +ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf> +nfsaddrs= is an alias to ip= and can be used too. + +<client-ip> IP address of the client. If empty, the address will + either be determined by RARP/BOOTP/DHCP. What protocol + is used de- pends on the <autoconf> parameter. If this + parameter is not empty, autoconf will be used. + +<server-ip> IP address of the NFS server. If RARP is used to + determine the client address and this parameter is NOT + empty only replies from the specified server are + accepted. To use different RARP and NFS server, + specify your RARP server here (or leave it blank), and + specify your NFS server in the 'nfsroot' parameter + (see above). If this entry is blank the address of the + server is used which answered the RARP/BOOTP/DHCP + request. + +<gw-ip> IP address of a gateway if the server is on a different + subnet. If this entry is empty no gateway is used and the + server is assumed to be on the local network, unless a + value has been received by BOOTP/DHCP. + +<netmask> Netmask for local network interface. If this is empty, + the netmask is derived from the client IP address assuming + classful addressing, unless overridden in BOOTP/DHCP reply. + +<hostname> Name of the client. If empty, the client IP address is + used in ASCII notation, or the value received by + BOOTP/DHCP. + +<device> Name of network device to use. If this is empty, all + devices are used for RARP/BOOTP/DHCP requests, and the + first one we receive a reply on is configured. If you + have only one device, you can safely leave this blank. + +<autoconf> Method to use for autoconfiguration. If this is either + 'rarp', 'bootp', or 'dhcp' the specified protocol is + used. If the value is 'both', 'all' or empty, all + protocols are used. 'off', 'static' or 'none' means + no autoconfiguration. +Examples: +ip=127.0.0.1:::::lo:none --> Enable the loopback interface. +ip=192.168.1.1:::::eth2:none --> Enable static eth2 interface. +ip=:::::eth0:dhcp --> Enable dhcp protcol for eth0 configuration. + +nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>] + +If the 'nfsroot' parameter is NOT given on the command line, the default +"/tftpboot/%s" will be used. + +<server-ip> Specifies the IP address of the NFS server. If this field + is not given, the default address as determined by the + 'ip' variable (see below) is used. One use of this + parameter is for example to allow using different servers + for RARP and NFS. Usually you can leave this blank. + +<root-dir> Name of the directory on the server to mount as root. If + there is a "%s" token in the string, the token will be + replaced by the ASCII-representation of the client's IP + address. + +<nfs-options> Standard NFS options. All options are separated by commas. + If the options field is not given, the following defaults + will be used: + port = as given by server portmap daemon + rsize = 1024 + wsize = 1024 + timeo = 7 + retrans = 3 + acregmin = 3 + acregmax = 60 + acdirmin = 30 + acdirmax = 60 + flags = hard, nointr, noposix, cto, ac + +root=/dev/nfs + +If you don't use nfsroot= parameter you need to set root=/dev/nfs +to boot from a nfs root by autoconfiguration. HELPEOF } + +# vim: set ft=sh ts=4 sw=4 et: diff --git a/install/pata b/install/pata index 75a75c1..c51356e 100644 --- a/install/pata +++ b/install/pata @@ -9,7 +9,7 @@ build() { } help() { - cat<<HELPEOF + cat <<HELPEOF This hook loads the necessary modules for a pata (ide) root device, using the new libata subsystem. Detection will take place at runtime. To minimize the modules in the image, add the autodetect hook too. diff --git a/install/pcmcia b/install/pcmcia index 7930d83..b390497 100644 --- a/install/pcmcia +++ b/install/pcmcia @@ -1,25 +1,23 @@ -# vim: set ft=sh: +#!/bin/bash -build() -{ +build() { + FILES="/etc/pcmcia/config.opts" MODULES=" $(checked_modules '/drivers/pcmcia/' | grep -ve 'sound' -e 'net') $(checked_modules '/ide/legacy')" - MODULES=$(echo ${MODULES}) #trim whitespace - if [ -n "${MODULES}" ]; then - MODULES="${MODULES} sd_mod" + + if [[ $MODULES ]]; then + MODULES+=" sd_mod" fi - BINARIES="" - FILES="/etc/pcmcia/config.opts" - SCRIPT="" add_binary "/lib/udev/pcmcia-socket-startup" add_binary "/lib/udev/pcmcia-check-broken-cis" add_file "/lib/udev/rules.d/60-pcmcia.rules" } -help () -{ -cat<<HELPEOF - This hook loads the necessary modules for a pcmcia root device. - Detection will take place at runtime. To minimize the modules - in the image, add the autodetect hook too. +help() { + cat <<HELPEOF +This hook loads the necessary modules for a pcmcia root device. Detection will +take place at runtime. To minimize the modules in the image, add the autodetect +hook too. HELPEOF } + +# vim: set ft=sh ts=4 sw=4 et: diff --git a/install/resume b/install/resume index dcf6442..d261aad 100644 --- a/install/resume +++ b/install/resume @@ -1,17 +1,14 @@ -# vim:set ft=sh: +#!/bin/bash -build() -{ - MODULES="" - BINARIES="" - FILES="" +build() { SCRIPT="resume" } -help () -{ -cat<<HELPEOF - This hook initializes support for resuming from Disk. - Supports swsusp and suspend2. +help() { + cat <<HELPEOF +This hook initializes support for resuming from Disk. Supports swsusp and +suspend2. HELPEOF } + +# vim: set ft=sh ts=4 sw=4 et: diff --git a/install/sata b/install/sata index 1b39d5f..39fe805 100644 --- a/install/sata +++ b/install/sata @@ -10,7 +10,7 @@ build() { } help() { - cat<<HELPEOF + cat <<HELPEOF This hook loads the necessary modules for an sata root device. Detection will take place at runtime. To minimize the modules in the image, add the autodetect hook too. diff --git a/install/scsi b/install/scsi index 2641255..fa9e5d9 100644 --- a/install/scsi +++ b/install/scsi @@ -10,7 +10,7 @@ build(){ } help() { - cat<<HELPEOF + cat <<HELPEOF This hook loads the necessary modules for an scsi root device. Detection will take place at runtime. To minimize the modules in the image, add the autodetect hook too. diff --git a/install/sleep b/install/sleep index c7a8902..b81e1ca 100644 --- a/install/sleep +++ b/install/sleep @@ -1,22 +1,17 @@ -# vim:set ft=sh: +#!/bin/bash -build() -{ - MODULES="" - BINARIES="" - FILES="" +build() { SCRIPT="sleep" } -help () -{ -cat <<HELPEOF - This hook causes the init process to interrupt - for a fixed time interval. The time in seconds - can be specified in the sleeptime= command line - parameter. The default is 5 seconds. - If a sleepdevice= parameter is specified, sleep - until the given device node is available, polling - at one second intervals until sleeptime is reached. +help() { + cat <<HELPEOF +This hook causes the init process to interrupt for a fixed time interval. The +time in seconds can be specified in the sleeptime= command line parameter. The +default is 5 seconds. If a sleepdevice= parameter is specified, sleep until the +given device node is available, polling at one second intervals until sleeptime +is reached. HELPEOF } + +# vim: set ft=sh ts=4 sw=4 et: diff --git a/install/udev b/install/udev index 74c9b5e..6d0804b 100644 --- a/install/udev +++ b/install/udev @@ -1,27 +1,26 @@ -# vim:set ft=sh: +#!/bin/bash -build() -{ - MODULES="" - BINARIES="" - FILES=" /etc/udev/udev.conf" +build() { + FILES="/etc/udev/udev.conf" SCRIPT="udev" + add_binary /sbin/udevd add_binary /sbin/udevadm - for rules in 50-firmware.rules 50-udev-default.rules 60-persistent-storage.rules 80-drivers.rules; do - add_file /lib/udev/rules.d/${rules} + + for rules in 50-{firmware,udev-default}.rules 60-persistent-storage.rules 80-drivers.rules; do + add_file "/lib/udev/rules.d/$rules" done - for tool in firmware ata_id path_id scsi_id usb_id; do - add_file /lib/udev/${tool} + for tool in firmware {ata,path,scsi,usb}_id; do + add_file "/lib/udev/$tool" done } -help () -{ -cat <<HELPEOF - This hook will use udev to create your root device node - and detect the needed modules for your root device. It - is also required for firmware loading in initramfs. - It is recommended to use this hook. +help() { + cat <<HELPEOF +This hook will use udev to create your root device node and detect the needed +modules for your root device. It is also required for firmware loading in +initramfs. It is recommended to use this hook. HELPEOF } + +# vim: set ft=sh ts=4 sw=4 et: diff --git a/install/usb b/install/usb index db2d08e..61020ab 100644 --- a/install/usb +++ b/install/usb @@ -1,24 +1,20 @@ -# vim: set ft=sh: +#!/bin/bash -build() -{ - MODULES=" $(checked_modules "/usb/host" | grep -ve "_cs" -e "sl811_hcd" -e "isp116x_hcd")" +build() { + MODULES="$(checked_modules "/usb/host" | grep -ve "_cs" -e "sl811_hcd" -e "isp116x_hcd")" - MODULES=$(echo ${MODULES}) #trim whitespace - if [ -n "${MODULES}" ]; then - MODULES="${MODULES} usb_storage sd_mod sr_mod" - MODULES="${MODULES} $(checked_modules "drivers/usb/storage/ums-*")" + if [[ $MODULES ]]; then + MODULES+=" usb_storage sd_mod sr_mod" + MODULES+=" $(checked_modules "drivers/usb/storage/ums-*")" fi - BINARIES="" - FILES="" - SCRIPT="" } -help () -{ -cat<<HELPEOF - This hook loads the necessary modules for an usb root device. - Detection will take place at runtime. To minimize the modules - in the image, add the autodetect hook too. +help() { + cat <<HELPEOF +This hook loads the necessary modules for an usb root device. Detection will +take place at runtime. To minimize the modules in the image, add the autodetect +hook too. HELPEOF } + +# vim: set ft=sh ts=4 sw=4 et: diff --git a/install/usbinput b/install/usbinput index e4bf27e..aa4e1a6 100644 --- a/install/usbinput +++ b/install/usbinput @@ -1,24 +1,18 @@ -# vim: set ft=sh: +#!/bin/bash -build() -{ - MODULES=" $(checked_modules "/usb/host" | grep -ve "_cs" -e "sl811_hcd" -e "isp116x_hcd") " - MODULES=" $(echo ${MODULES}) $(all_modules "/hid/hid-") " +build() { + MODULES=" $(checked_modules "/usb/host" | grep -ve "_cs" -e "sl811_hcd" -e "isp116x_hcd")" + MODULES+=" $(all_modules "/hid/hid-")" - MODULES=$(echo ${MODULES}) #trim whitespace - if [ -n "${MODULES}" ]; then - MODULES="${MODULES} usbhid" - fi - BINARIES="" - FILES="" - SCRIPT="" + [[ $MODULES ]] && MODULES+=" usbhid" } -help () -{ -cat<<HELPEOF - This hook loads the necessary modules for an usb input device. - Detection will take place at runtime. To minimize the modules - in the image, add the autodetect hook too. +help() { + cat <<HELPEOF +This hook loads the necessary modules for an usb input device. Detection +will take place at runtime. To minimize the modules in the image, add the +autodetect hook too. HELPEOF } + +# vim: set ft=sh ts=4 sw=4 et: -- 1.7.6.4
On Mon, Sep 26, 2011 at 8:22 PM, Dave Reisner <d@falconindy.com> wrote:
This introduces no logical code changes -- this is purely a syntactical cleanup and standardization across the build hooks. All hooks get the same treatment, adhering to the following style:
#!/bin/bash
build() { COMMANDS }
help() { cat <<HELPEOF This is a help message. HELPEOF }
# vim: set ft=sh ts=4 sw=4 et:
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- install/btrfs | 15 ++-- install/dsdt | 21 ++---- install/filesystems | 2 +- install/fw | 29 +++----- install/ide | 30 +++----- install/keymap | 2 +- install/memdisk | 19 +++--- install/net | 195 +++++++++++++++++++++++++-------------------------- install/pata | 2 +- install/pcmcia | 28 ++++---- install/resume | 19 ++--- install/sata | 2 +- install/scsi | 2 +- install/sleep | 27 +++---- install/udev | 33 ++++----- install/usb | 30 ++++----- install/usbinput | 30 +++----- 17 files changed, 220 insertions(+), 266 deletions(-)
-help () -{ -cat <<HELPEOF - This hook is needed to support Btrfs volumes spread - over multiple devices. +help() { + cat <<HELPEOF +This hook is needed to support Btrfs volumes spread over multiple devices. HELPEOF Any reason for re-wrapping the help messages you didn't change? Or at least mention in the commit message "all help text has been re-wrapped to 76/80/whatever characters."
-Dan
The doubled up leading slashes annoy me in the verbose output. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- install/base | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/install/base b/install/base index 64ef39a..b4f23d5 100644 --- a/install/base +++ b/install/base @@ -1,7 +1,7 @@ #!/bin/bash build() { - for dir in proc sys dev run /usr/{bin,sbin}; do + for dir in proc sys dev run usr/{bin,sbin}; do add_dir "/$dir" done -- 1.7.6.4
We conditionally, but naively, add modules in some of our install hooks, but the kernel may not have these. Note that these modules can fail silently by detecting a '?' suffix on the module name. In conjunction with this, the add_module function now takes a flag, -t or --try, which will ignore module not found errors from modinfo. The config file will also support this syntax. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- functions | 20 ++++++++++++++++---- install/base | 2 +- install/fw | 2 +- install/ide | 2 +- install/pata | 2 +- install/pcmcia | 5 ++--- install/sata | 2 +- install/scsi | 2 +- install/usb | 4 +++- install/usbinput | 4 +--- 10 files changed, 28 insertions(+), 17 deletions(-) diff --git a/functions b/functions index 3c0cd89..c7e167e 100644 --- a/functions +++ b/functions @@ -137,6 +137,13 @@ add_module() { # $1: module name local module path dep deps field value + local -i ign_errors=0 + + if [[ $1 = -@(t|-try) ]]; then + ign_errors=1 + shift + fi + module=${1%.ko*} # skip expensive stuff if this module has already been added @@ -162,6 +169,7 @@ add_module() { done < <(modinfo -b "$BASEDIR" -k "$KERNELVERSION" -0 "$module" 2>/dev/null) if [[ -z $path ]]; then + (( ign_errors )) && return 0 error "module not found: \`%s'" "$module" return 1 fi @@ -173,9 +181,9 @@ add_module() { # explicit module depends case "$module" in - fat) add_module "nls_cp437" ;; - ocfs2) add_module "configfs" ;; - libcrc32c) add_module "crc32c"; add_module "crc32c_intel" ;; + fat) add_module --try "nls_cp437" ;; + ocfs2) add_module --try "configfs" ;; + libcrc32c) add_module --try "crc32c"; add_module --try "crc32c_intel" ;; esac } @@ -291,7 +299,11 @@ parse_hook() { local item for item in $MODULES; do - add_module "$item" + if [[ ${item:(-1)} = '?' ]]; then + try=--try + item=${item%\?} + fi + add_module $try "$item" done for item in $BINARIES; do diff --git a/install/base b/install/base index b4f23d5..e85551c 100644 --- a/install/base +++ b/install/base @@ -24,7 +24,7 @@ build() { read -r -a hooks <<< "$HOOKS" { - (( ${#modules[*]} )) && printf 'MODULES="%s"\n' "${modules[*]}" + (( ${#modules[*]} )) && printf 'MODULES="%s"\n' "${modules[*]%\?}" (( ${#hooks[*]} )) && printf 'HOOKS="%s"\n' "${hooks[*]}" } >"$BUILDROOT/config" ) diff --git a/install/fw b/install/fw index 94e70d1..f624de0 100644 --- a/install/fw +++ b/install/fw @@ -3,7 +3,7 @@ build() { MODULES=$(checked_modules "/drivers/firewire/") - [[ $MODULES ]] && MODULES+=" firewire-sbp2 sd_mod sr_mod" + [[ $MODULES ]] && MODULES+=" firewire-sbp2? sd_mod? sr_mod?" } help() { diff --git a/install/ide b/install/ide index 9443dd3..a8d9e97 100644 --- a/install/ide +++ b/install/ide @@ -3,7 +3,7 @@ build() { MODULES="$(checked_modules "/ide/" | grep -v "legacy")" - [[ $MODULES ]] && MODULES+=" ide-gd_mod" + [[ $MODULES ]] && MODULES+=" ide-gd_mod?" } help() { diff --git a/install/pata b/install/pata index c51356e..76f268c 100644 --- a/install/pata +++ b/install/pata @@ -5,7 +5,7 @@ build() { MODULES+=" $(checked_modules "$filter")" done - [[ $MODULES ]] && MODULES+=" sd_mod" + [[ $MODULES ]] && MODULES+=" sd_mod?" } help() { diff --git a/install/pcmcia b/install/pcmcia index b390497..2e9ac9a 100644 --- a/install/pcmcia +++ b/install/pcmcia @@ -4,9 +4,8 @@ build() { FILES="/etc/pcmcia/config.opts" MODULES=" $(checked_modules '/drivers/pcmcia/' | grep -ve 'sound' -e 'net') $(checked_modules '/ide/legacy')" - if [[ $MODULES ]]; then - MODULES+=" sd_mod" - fi + [[ $MODULES ]] MODULES+=" sd_mod?" + add_binary "/lib/udev/pcmcia-socket-startup" add_binary "/lib/udev/pcmcia-check-broken-cis" add_file "/lib/udev/rules.d/60-pcmcia.rules" diff --git a/install/sata b/install/sata index 39fe805..c9b67c3 100644 --- a/install/sata +++ b/install/sata @@ -6,7 +6,7 @@ build() { MODULES+=" $(checked_modules "$filter")" done - [[ $MODULES ]] && MODULES+=" sd_mod" + [[ $MODULES ]] && MODULES+=" sd_mod?" } help() { diff --git a/install/scsi b/install/scsi index fa9e5d9..4c2abc5 100644 --- a/install/scsi +++ b/install/scsi @@ -6,7 +6,7 @@ build(){ $(checked_modules "/block/" | grep -E '(cciss|cpqarray|DAC960)') $(checked_modules "/fusion/")" - [[ $MODULES ]] && MODULES+=" sd_mod" + [[ $MODULES ]] && MODULES+=" sd_mod?" } help() { diff --git a/install/usb b/install/usb index 61020ab..fcb2a47 100644 --- a/install/usb +++ b/install/usb @@ -1,10 +1,12 @@ #!/bin/bash build() { + local module= + MODULES="$(checked_modules "/usb/host" | grep -ve "_cs" -e "sl811_hcd" -e "isp116x_hcd")" if [[ $MODULES ]]; then - MODULES+=" usb_storage sd_mod sr_mod" + MODULES+=" usb_storage? sd_mod? sr_mod?" MODULES+=" $(checked_modules "drivers/usb/storage/ums-*")" fi } diff --git a/install/usbinput b/install/usbinput index aa4e1a6..f89d0bd 100644 --- a/install/usbinput +++ b/install/usbinput @@ -2,9 +2,7 @@ build() { MODULES=" $(checked_modules "/usb/host" | grep -ve "_cs" -e "sl811_hcd" -e "isp116x_hcd")" - MODULES+=" $(all_modules "/hid/hid-")" - - [[ $MODULES ]] && MODULES+=" usbhid" + MODULES+=" $(all_modules "/hid/hid-") usbhid?" } help() { -- 1.7.6.4
On Monday, September 26, 2011, Dave Reisner <d@falconindy.com> wrote:
We conditionally, but naively, add modules in some of our install hooks, but the kernel may not have these. Note that these modules can fail silently by detecting a '?' suffix on the module name. In conjunction with this, the add_module function now takes a flag, -t or --try, which will ignore module not found errors from modinfo. The config file will also support this syntax.
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- functions | 20 ++++++++++++++++---- install/base | 2 +- install/fw | 2 +- install/ide | 2 +- install/pata | 2 +- install/pcmcia | 5 ++--- install/sata | 2 +- install/scsi | 2 +- install/usb | 4 +++- install/usbinput | 4 +--- 10 files changed, 28 insertions(+), 17 deletions(-)
diff --git a/functions b/functions index 3c0cd89..c7e167e 100644 --- a/functions +++ b/functions @@ -137,6 +137,13 @@ add_module() { # $1: module name
local module path dep deps field value + local -i ign_errors=0 + + if [[ $1 = -@(t|-try) ]]; then Wouldn't @(-t|--try) be a lot clearer? Or is just my eyes that cringe at this cuteness. I spent a good 15 seconds trying to figure out how -try got translated to --try here. + ign_errors=1 + shift + fi + module=${1%.ko*}
# skip expensive stuff if this module has already been added
From: Dave Reisner <d@falconindy.com> Make sure these are completely safe for user input. Use the same three step process in both cases: 1) Strip any trailing slash 2) Trim the string according to base/dir request 3) Print the result, defaulting to / if step 2 yielded an empty string Signed-off-by: Dave Reisner <d@falconindy.com> --- functions | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) diff --git a/functions b/functions index c7e167e..2f5797a 100644 --- a/functions +++ b/functions @@ -30,15 +30,16 @@ die() { cleanup 1 } -get_dirname() { - # strip any trailing slash first... - local dir="${1%/}" - # then get the directory portion - echo "${dir%/*}" +get_basename() { + local base=${1%/} + base=${base##*/} + printf '%s' "${base:-/}" } -get_basename() { - echo "${1##*/}" +get_dirname() { + local dir=${1%/} + dir=${dir%/*} + printf '%s' "${dir:-/}" } in_array() { -- 1.7.6.4
On Mon, Sep 26, 2011 at 8:22 PM, Dave Reisner <d@falconindy.com> wrote:
From: Dave Reisner <d@falconindy.com>
Make sure these are completely safe for user input. Use the same three step process in both cases:
1) Strip any trailing slash 2) Trim the string according to base/dir request 3) Print the result, defaulting to / if step 2 yielded an empty string
Signed-off-by: Dave Reisner <d@falconindy.com> --- functions | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/functions b/functions index c7e167e..2f5797a 100644 --- a/functions +++ b/functions @@ -30,15 +30,16 @@ die() { cleanup 1 }
-get_dirname() { - # strip any trailing slash first... - local dir="${1%/}" - # then get the directory portion - echo "${dir%/*}" +get_basename() { + local base=${1%/} + base=${base##*/} + printf '%s' "${base:-/}" }
-get_basename() { - echo "${1##*/}" +get_dirname() { + local dir=${1%/} + dir=${dir%/*} + printf '%s' "${dir:-/}" }
Did you flip the order of the functions just to make the diff trickier? Otherwise this looks OK.
in_array() { -- 1.7.6.4
We used to do this, but it was lost somewhere along the way in fixing up basedir support. Add in a 'pathlookup' function which can do a search within any given basedir. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- functions | 26 +++++++++++++++++++++++++- 1 files changed, 25 insertions(+), 1 deletions(-) diff --git a/functions b/functions index 2f5797a..8ce24ea 100644 --- a/functions +++ b/functions @@ -55,6 +55,26 @@ in_array() { return 1 # Not Found } +pathlookup() { + # a basedir aware 'type -P' (or which) for executables + # $1: binary to find + + local path= + local -a paths= + + IFS=: read -r -a paths <<< "$PATH" + + for path in "${paths[@]}"; do + [[ ${path:0:1} = [.~] ]] && continue + if [[ -x $BASEDIR$path/$1 ]]; then + printf '%s' "$BASEDIR$path/$1" + return 0 + fi + done + + return 1 +} + _add_file() { # add a file to $BUILDROOT # $1: pathname on initcpio @@ -259,7 +279,11 @@ add_binary() { local -a sodeps local regex binary dest mode sodep resolved dirname - binary=$BASEDIR$1 + if [[ ${1:0:1} != '/' ]]; then + binary=$(pathlookup "$1") + else + binary=$BASEDIR$1 + fi [[ -f "$binary" ]] || { error "file not found: \`%s'" "$binary"; return 1; } -- 1.7.6.4
Without specifying this, xargs will split arguments on whitespace as well as newlines, and will interpret quoting and backslashes. When the delimiter is specified, every character is taken literally and only the given delimiter in honored. This sidesteps issues with broken modalias files as evidenced by a MacBookAir3,1 or the bbs thread below: https://bbs.archlinux.org/viewtopic.php?pid=971853 Also fixes FS#25450. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- functions | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/functions b/functions index 8ce24ea..7f9202f 100644 --- a/functions +++ b/functions @@ -117,7 +117,7 @@ auto_modules() { IFS=$'\n' read -rd '' -a mods < \ <(find /sys/devices -name modalias -exec sort -u {} + | - xargs modprobe -d "$BASEDIR" -aRS "$KERNELVERSION" | + xargs -d $'\n' modprobe -d "$BASEDIR" -aRS "$KERNELVERSION" | sort -u) printf "%s\n" "${mods[@]//-/_}" -- 1.7.6.4
On Mon, Sep 26, 2011 at 8:22 PM, Dave Reisner <d@falconindy.com> wrote:
Without specifying this, xargs will split arguments on whitespace as well as newlines, and will interpret quoting and backslashes. When the delimiter is specified, every character is taken literally and only the given delimiter in honored.
This sidesteps issues with broken modalias files as evidenced by a MacBookAir3,1 or the bbs thread below:
https://bbs.archlinux.org/viewtopic.php?pid=971853
Also fixes FS#25450.
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- functions | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/functions b/functions index 8ce24ea..7f9202f 100644 --- a/functions +++ b/functions @@ -117,7 +117,7 @@ auto_modules() {
IFS=$'\n' read -rd '' -a mods < \ <(find /sys/devices -name modalias -exec sort -u {} + | - xargs modprobe -d "$BASEDIR" -aRS "$KERNELVERSION" | + xargs -d $'\n' modprobe -d "$BASEDIR" -aRS "$KERNELVERSION" | Dollar sign what? /me doesn't follow this at all, a comment would be great.
sort -u)
printf "%s\n" "${mods[@]//-/_}" -- 1.7.6.4
On Mon, Sep 26, 2011 at 10:46:57PM -0500, Dan McGee wrote:
On Mon, Sep 26, 2011 at 8:22 PM, Dave Reisner <d@falconindy.com> wrote:
Without specifying this, xargs will split arguments on whitespace as well as newlines, and will interpret quoting and backslashes. When the delimiter is specified, every character is taken literally and only the given delimiter in honored.
This sidesteps issues with broken modalias files as evidenced by a MacBookAir3,1 or the bbs thread below:
https://bbs.archlinux.org/viewtopic.php?pid=971853
Also fixes FS#25450.
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- functions | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/functions b/functions index 8ce24ea..7f9202f 100644 --- a/functions +++ b/functions @@ -117,7 +117,7 @@ auto_modules() {
IFS=$'\n' read -rd '' -a mods < \ <(find /sys/devices -name modalias -exec sort -u {} + | - xargs modprobe -d "$BASEDIR" -aRS "$KERNELVERSION" | + xargs -d $'\n' modprobe -d "$BASEDIR" -aRS "$KERNELVERSION" | Dollar sign what? /me doesn't follow this at all, a comment would be great.
consult your manual, sir! Words of the form $'string' are treated specially. The word expands to string, with backslash-escaped characters replaced as specified by the ANSI C standard. Backslash escape sequences, if present, are decoded. In other words, its expanded in place. Yeah, this seems elementary to me, but I suppose its comment worthy.
sort -u)
printf "%s\n" "${mods[@]//-/_}" -- 1.7.6.4
On Mon, Sep 26, 2011 at 10:48 PM, Dave Reisner <d@falconindy.com> wrote:
On Mon, Sep 26, 2011 at 10:46:57PM -0500, Dan McGee wrote:
On Mon, Sep 26, 2011 at 8:22 PM, Dave Reisner <d@falconindy.com> wrote:
Without specifying this, xargs will split arguments on whitespace as well as newlines, and will interpret quoting and backslashes. When the delimiter is specified, every character is taken literally and only the given delimiter in honored.
This sidesteps issues with broken modalias files as evidenced by a MacBookAir3,1 or the bbs thread below:
https://bbs.archlinux.org/viewtopic.php?pid=971853
Also fixes FS#25450.
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- functions | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/functions b/functions index 8ce24ea..7f9202f 100644 --- a/functions +++ b/functions @@ -117,7 +117,7 @@ auto_modules() {
IFS=$'\n' read -rd '' -a mods < \ <(find /sys/devices -name modalias -exec sort -u {} + | - xargs modprobe -d "$BASEDIR" -aRS "$KERNELVERSION" | + xargs -d $'\n' modprobe -d "$BASEDIR" -aRS "$KERNELVERSION" | Dollar sign what? /me doesn't follow this at all, a comment would be great.
consult your manual, sir!
Words of the form $'string' are treated specially. The word expands to string, with backslash-escaped characters replaced as specified by the ANSI C standard. Backslash escape sequences, if present, are decoded.
In other words, its expanded in place. Yeah, this seems elementary to me, but I suppose its comment worthy.
Well when you say "consult your man page", I thought to myself, "Damn, did I really miss that? Let's read again." --delimiter=delim -d delim Input items are terminated by the specified character. Quotes and backslash are not special; every character in the input is taken literally. Disables the end-of-file string, which is treated like any other argument. This can be used when the in‐ put consists of simply newline-separated items, although it is almost always better to design your program to use --null where this is possible. The specified delimiter may be a single char‐ acter, a C-style character escape such as \n, or an octal or hexadecimal escape code. Octal and hexadecimal escape codes are understood as for the printf command. Multibyte characters are not supported. Nope! Nothing there. Then I realized "Oh! He is talking about some bash feature and THAT is the manpage I'm supposed to be reading." It isn't elementary to those of us that don't use shell as much as you, and RTFM on a 5439 line gargantuan manpage is not my idea of fun, not to mention the 118 lines of hits for the literal '$' character (because I would have no idea in hell how else to find it). -Dan
Also make sure that simple variables are declared as null strings. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- functions | 12 +++++++++--- mkinitcpio | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/functions b/functions index 7f9202f..64a1d17 100644 --- a/functions +++ b/functions @@ -115,6 +115,8 @@ _add_symlink() { auto_modules() { # Perform auto detection of modules via sysfs. + local mods= + IFS=$'\n' read -rd '' -a mods < \ <(find /sys/devices -name modalias -exec sort -u {} + | xargs -d $'\n' modprobe -d "$BASEDIR" -aRS "$KERNELVERSION" | @@ -129,6 +131,8 @@ all_modules() { # $@: filter arguments to grep local -i count=0 + local mod= + while read -r -d '' mod; do (( ++count )) mod=${mod##*/} @@ -157,7 +161,7 @@ add_module() { # discovered and added. # $1: module name - local module path dep deps field value + local module= path= dep= deps= field= value= local -i ign_errors=0 if [[ $1 = -@(t|-try) ]]; then @@ -213,6 +217,8 @@ add_full_dir() { # No parsing is performed and the contents of the directory is added as is. # $1: path to directory + local f= + if [[ -n $1 && -d $1 ]]; then for f in "$1"/*; do if [[ -d "$f" ]]; then @@ -277,7 +283,7 @@ add_binary() { # $2: destination on initcpio (optional, defaults to same as source) local -a sodeps - local regex binary dest mode sodep resolved dirname + local line= regex= binary= dest= mode= sodep= resolved= dirname= if [[ ${1:0:1} != '/' ]]; then binary=$(pathlookup "$1") @@ -321,7 +327,7 @@ parse_hook() { # prior to the start of hook processing, and after each hook's build # function is run. - local item + local item= for item in $MODULES; do if [[ ${item:(-1)} = '?' ]]; then diff --git a/mkinitcpio b/mkinitcpio index 49dabbd..82faaaf 100755 --- a/mkinitcpio +++ b/mkinitcpio @@ -21,7 +21,7 @@ INSTDIR=install PRESETDIR=mkinitcpio.d COMPRESSION=gzip -declare TMPDIR BASEDIR MODULE_FILE GENIMG PRESET COMPRESSION_OPTIONS BUILDROOT +declare TMPDIR= BASEDIR= MODULE_FILE= GENIMG= PRESET= COMPRESSION_OPTIONS= BUILDROOT= declare NC= BOLD= BLUE= GREEN= RED= YELLOW= declare -i QUIET=1 SHOW_AUTOMODS=0 SAVELIST=0 COLOR=1 declare -a SKIPHOOKS ADDED_MODULES MODPATHS @@ -74,7 +74,7 @@ cleanup () } get_kernver() { - local kernel=$1 + local kernver= kernel=$1 if [[ "${kernel:0:1}" != / ]]; then echo $kernel -- 1.7.6.4
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- mkinitcpio | 7 +------ 1 files changed, 1 insertions(+), 6 deletions(-) diff --git a/mkinitcpio b/mkinitcpio index 82faaaf..dd67030 100755 --- a/mkinitcpio +++ b/mkinitcpio @@ -108,12 +108,7 @@ while getopts ':c:k:sb:g:p:m:nvH:LMhS:t:z:' arg; do p) PRESET="${OPTARG}" ;; n) COLOR=0 ;; v) QUIET=0 ;; - S) OLDIFS=${IFS} - IFS=, - SKIPHOOKS=(${OPTARG}) - IFS=${OLDIFS} - unset OLDIFS - ;; + S) IFS=, read -r -a SKIPHOOKS <<< "$OPTARG" ;; H) if [[ ! -r "${INSTDIR}/${OPTARG}" ]]; then error "No hook ${OPTARG}" exit 1 -- 1.7.6.4
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- mkinitcpio | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mkinitcpio b/mkinitcpio index dd67030..98bea64 100755 --- a/mkinitcpio +++ b/mkinitcpio @@ -246,7 +246,7 @@ if [[ $GENIMG ]]; then fi if [[ ! -f "$CONFIG" ]]; then - die "Config file does not exist: \`%s'" " $CONFIG" + die "Config file does not exist: \`%s'" "$CONFIG" fi . "$CONFIG" @@ -356,7 +356,7 @@ if [[ "${GENIMG}" ]]; then fi if [[ $errmsg ]]; then - error "Image generation FAILED: %s\n" "$errmsg" + error "Image generation FAILED: %s" "$errmsg" status=1 else msg "Image generation successful" -- 1.7.6.4
Avoids explosions if a user has no HOOKS in their config, as seen: https://bbs.archlinux.org/viewtopic.php?pid=966344 Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- mkinitcpio | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/mkinitcpio b/mkinitcpio index 98bea64..0116722 100755 --- a/mkinitcpio +++ b/mkinitcpio @@ -183,6 +183,9 @@ fi TMPDIR=$(mktemp -d "${TMPDIR:-/tmp}/mkinitcpio.XXXXXX") declare BUILDROOT=$TMPDIR/root +# explicitly create the buildroot +mkdir "$TMPDIR/root" + # use preset $PRESET if [[ $PRESET ]]; then # allow absolute path to preset file, else resolve it -- 1.7.6.4
Instead of bailing entirely, throw an error, and ensure that we exit with a non-zero status. The user might do something as simple as misspell a hook name which may or may not prevent a useful image from being created. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- mkinitcpio | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/mkinitcpio b/mkinitcpio index 0116722..72e7ec8 100755 --- a/mkinitcpio +++ b/mkinitcpio @@ -312,7 +312,8 @@ for hook in ${HOOKS}; do fi parse_hook else - die "Hook '$hook' can not be found." + error "Hook '$hook' can not be found." + (( ++builderrors )) fi done -- 1.7.6.4
This avoids errors with process substitutions in chroots, among other things. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- mkinitcpio | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/mkinitcpio b/mkinitcpio index 72e7ec8..5419d9b 100755 --- a/mkinitcpio +++ b/mkinitcpio @@ -156,6 +156,9 @@ if [[ -t 2 ]] && (( COLOR )); then fi readonly NC BOLD BLUE GREEN RED YELLOW +# insist that /dev be mounted (important for chroots) +findmnt /dev &>/dev/null || die "/dev is not mounted" + if [[ $BASEDIR ]]; then # resolve the path. it might be a relative path and/or contain symlinks if ! pushd "$BASEDIR" &>/dev/null; then -- 1.7.6.4
Add in 'premount' and 'postmount' as trigger conditions, but also leave in the old 'y' value as a synonym for premount. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- init | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/init b/init index 8c8709c..a0e082e 100644 --- a/init +++ b/init @@ -74,8 +74,8 @@ if [ -e "/hooks" ]; then done fi -if [ "${break}" = "y" ]; then - echo ":: Break requested, type 'exit' to resume operation" +if [ "${break}" = "y" ] || [ "${break}" = "premount" ]; then + echo ":: Pre-mount break requested, type 'exit' to resume operation" launch_interactive_shell fi @@ -100,6 +100,11 @@ elif [ ! -x "/new_root${init}" ]; then launch_interactive_shell --exec fi +if [ "${break}" = "postmount" ]; then + echo ":: Post-mount break requested, type 'exit' to resume operation" + launch_interactive_shell +fi + # Stop udevd if is running if [ "${udevd_running}" -eq 1 ]; then udevadm control --exit -- 1.7.6.4
Add in 'premount' and 'postmount' as trigger conditions, but also leave in the old 'y' value as a synonym for premount. Might be worth a code comment for the next guy that comes and looks at
On Mon, Sep 26, 2011 at 8:22 PM, Dave Reisner <d@falconindy.com> wrote: this and goes WTF? Otherwise I like this added functionality.
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- init | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/init b/init index 8c8709c..a0e082e 100644 --- a/init +++ b/init @@ -74,8 +74,8 @@ if [ -e "/hooks" ]; then done fi
-if [ "${break}" = "y" ]; then - echo ":: Break requested, type 'exit' to resume operation" +if [ "${break}" = "y" ] || [ "${break}" = "premount" ]; then + echo ":: Pre-mount break requested, type 'exit' to resume operation" launch_interactive_shell fi
@@ -100,6 +100,11 @@ elif [ ! -x "/new_root${init}" ]; then launch_interactive_shell --exec fi
+if [ "${break}" = "postmount" ]; then + echo ":: Post-mount break requested, type 'exit' to resume operation" + launch_interactive_shell +fi + # Stop udevd if is running if [ "${udevd_running}" -eq 1 ]; then udevadm control --exit -- 1.7.6.4
This is already done in initscripts so we mirror it here. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- init | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/init b/init index a0e082e..ff4917a 100644 --- a/init +++ b/init @@ -22,7 +22,7 @@ else # /dev/mem is needed if we want to load uvesafb before triggering uevents mknod /dev/mem c 1 1 fi -mount -t tmpfs run /run -o nosuid,noexec,nodev,mode=755,size=10M +mount -t tmpfs run /run -o nosuid,nodev,mode=755,size=10M echo "/sbin/modprobe" > /proc/sys/kernel/modprobe -- 1.7.6.4
On Tue, Sep 27, 2011 at 3:22 AM, Dave Reisner <d@falconindy.com> wrote:
This is already done in initscripts so we mirror it here.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Acked-by: Tom Gundersen <teg@jklm.no>
--- init | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/init b/init index a0e082e..ff4917a 100644 --- a/init +++ b/init @@ -22,7 +22,7 @@ else # /dev/mem is needed if we want to load uvesafb before triggering uevents mknod /dev/mem c 1 1 fi -mount -t tmpfs run /run -o nosuid,noexec,nodev,mode=755,size=10M +mount -t tmpfs run /run -o nosuid,nodev,mode=755,size=10M
echo "/sbin/modprobe" > /proc/sys/kernel/modprobe
-- 1.7.6.4
This allows a user to provide their own binaries and override anything that might be provided by busybox. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- init | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/init b/init index ff4917a..e8f70a1 100644 --- a/init +++ b/init @@ -1,6 +1,6 @@ #!/bin/busybox ash # Install busybox's applets as symlinks -PATH=/usr/sbin:/usr/bin:/sbin:/bin +PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin busybox --install -s -- 1.7.6.4
On Mon, Sep 26, 2011 at 8:22 PM, Dave Reisner <d@falconindy.com> wrote:
This allows a user to provide their own binaries and override anything that might be provided by busybox.
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- init | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/init b/init index ff4917a..e8f70a1 100644 --- a/init +++ b/init @@ -1,6 +1,6 @@ #!/bin/busybox ash # Install busybox's applets as symlinks -PATH=/usr/sbin:/usr/bin:/sbin:/bin +PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin This is totally nitpicking, but we have this order by default in /etc/profile: PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"
Shouldn't we try to be consistent? Or at least figure out what normal is? Of course, from a CentOS box... $ echo $PATH /usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin:/home/dan/bin -Dan
On Mon, Sep 26, 2011 at 08:54:28PM -0500, Dan McGee wrote:
On Mon, Sep 26, 2011 at 8:22 PM, Dave Reisner <d@falconindy.com> wrote:
This allows a user to provide their own binaries and override anything that might be provided by busybox.
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- init | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/init b/init index ff4917a..e8f70a1 100644 --- a/init +++ b/init @@ -1,6 +1,6 @@ #!/bin/busybox ash # Install busybox's applets as symlinks -PATH=/usr/sbin:/usr/bin:/sbin:/bin +PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin This is totally nitpicking, but we have this order by default in /etc/profile: PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"
Shouldn't we try to be consistent? Or at least figure out what normal is?
Maybe it's another case of not being clear enough in the commit msg. We're sort of peeing all over /usr/bin on the busybox --install, so we need to be able to let the user have some control. We do that by letting them override binaries in /usr/local/bin and putting this bin above the rest. An extremely rare use case, but a use case none the less. I could, also, be talked out of this patch along with the busybox on build rather than run if it seems insane. mkinitcpio is sort of longer overdue for some documentation regarding the rules and regulations of hook writing. Merging this would sort of reinforce that point.
Of course, from a CentOS box... $ echo $PATH /usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin:/home/dan/bin
-Dan
Yeah, CentOS and RHEL both leave the /sbin's out of non root profiles. Not a concern here, for obvious reasons. d
On Mon, Sep 26, 2011 at 9:07 PM, Dave Reisner <d@falconindy.com> wrote:
On Mon, Sep 26, 2011 at 08:54:28PM -0500, Dan McGee wrote:
On Mon, Sep 26, 2011 at 8:22 PM, Dave Reisner <d@falconindy.com> wrote:
This allows a user to provide their own binaries and override anything that might be provided by busybox.
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- init | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/init b/init index ff4917a..e8f70a1 100644 --- a/init +++ b/init @@ -1,6 +1,6 @@ #!/bin/busybox ash # Install busybox's applets as symlinks -PATH=/usr/sbin:/usr/bin:/sbin:/bin +PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin This is totally nitpicking, but we have this order by default in /etc/profile: PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"
Shouldn't we try to be consistent? Or at least figure out what normal is?
Maybe it's another case of not being clear enough in the commit msg. We're sort of peeing all over /usr/bin on the busybox --install, so we need to be able to let the user have some control. We do that by letting them override binaries in /usr/local/bin and putting this bin above the rest. An extremely rare use case, but a use case none the less. I could, also, be talked out of this patch along with the busybox on build rather than run if it seems insane. I think you misinterpreted me. Note the order difference in yours vs. what I pasted from the stock Arch /etc/profile. Of course /local/ has to come first, but I was simply pointing out the "all /bin/ first" vs "all /local/ first" and other odd ordering choices.
mkinitcpio is sort of longer overdue for some documentation regarding the rules and regulations of hook writing. Merging this would sort of reinforce that point.
Of course, from a CentOS box... $ echo $PATH /usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin:/home/dan/bin
-Dan
Yeah, CentOS and RHEL both leave the /sbin's out of non root profiles. Not a concern here, for obvious reasons. Also not what I meant to point out- here, /sbin/ takes preference over /bin/, always, including local. So another totally different take.
And for some more orderings... $ pacman -Qlq initscripts | xargs grep PATH= /etc/rc.d/functions:export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" /sbin/rc.d: ENV=("PATH=/bin:/usr/bin:/sbin:/usr/sbin" -Dan
On Mon, Sep 26, 2011 at 10:54:16PM -0500, Dan McGee wrote:
On Mon, Sep 26, 2011 at 9:07 PM, Dave Reisner <d@falconindy.com> wrote:
On Mon, Sep 26, 2011 at 08:54:28PM -0500, Dan McGee wrote:
On Mon, Sep 26, 2011 at 8:22 PM, Dave Reisner <d@falconindy.com> wrote:
This allows a user to provide their own binaries and override anything that might be provided by busybox.
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- init | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/init b/init index ff4917a..e8f70a1 100644 --- a/init +++ b/init @@ -1,6 +1,6 @@ #!/bin/busybox ash # Install busybox's applets as symlinks -PATH=/usr/sbin:/usr/bin:/sbin:/bin +PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin This is totally nitpicking, but we have this order by default in /etc/profile: PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"
Shouldn't we try to be consistent? Or at least figure out what normal is?
Maybe it's another case of not being clear enough in the commit msg. We're sort of peeing all over /usr/bin on the busybox --install, so we need to be able to let the user have some control. We do that by letting them override binaries in /usr/local/bin and putting this bin above the rest. An extremely rare use case, but a use case none the less. I could, also, be talked out of this patch along with the busybox on build rather than run if it seems insane. I think you misinterpreted me. Note the order difference in yours vs. what I pasted from the stock Arch /etc/profile. Of course /local/ has to come first, but I was simply pointing out the "all /bin/ first" vs "all /local/ first" and other odd ordering choices.
Yep, I see it now. This is all somewhat suspect now anyways, and I probably can throw this out, as it was "needed" for the patchwork that installs busybox in the build, not the boot.
mkinitcpio is sort of longer overdue for some documentation regarding the rules and regulations of hook writing. Merging this would sort of reinforce that point.
Of course, from a CentOS box... $ echo $PATH /usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin:/home/dan/bin
-Dan
Yeah, CentOS and RHEL both leave the /sbin's out of non root profiles. Not a concern here, for obvious reasons. Also not what I meant to point out- here, /sbin/ takes preference over /bin/, always, including local. So another totally different take.
Also, I apparently can't read properly at 11pm. At least what I said about RHEL is true, but it clearly has no bearing here...
And for some more orderings... $ pacman -Qlq initscripts | xargs grep PATH= /etc/rc.d/functions:export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" /sbin/rc.d: ENV=("PATH=/bin:/usr/bin:/sbin:/usr/sbin"
Yay!!! We probably had a reason for this, but I believe ordering the /usr/local bins first has caused us pain with a user at least once. d
We don't know what processes will be run by the new init, but they should at least inherit a basic PATH to avoid any problems locating binaries. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- init | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/init b/init index e8f70a1..f14261d 100644 --- a/init +++ b/init @@ -118,6 +118,6 @@ for d in proc sys dev run; do umount /${d} fi done -exec env -i TERM=$TERM /sbin/switch_root -c /dev/console /new_root ${init} "$@" +exec env -i "TERM=$TERM" "PATH=$PATH" switch_root -c /dev/console /new_root ${init} "$@" # vim: set ft=sh ts=4 sw=4 et: -- 1.7.6.4
This is a constant which will never vary based on setup. Do it during the build to save the forks at runtime. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- init | 4 ---- install/base | 5 ++++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/init b/init index f14261d..8891a69 100644 --- a/init +++ b/init @@ -1,12 +1,8 @@ #!/bin/busybox ash -# Install busybox's applets as symlinks PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -busybox --install -s - . /init_functions -mkdir -p /new_root mount -t proc proc /proc -o nosuid,noexec,nodev mount -t sysfs sys /sys -o nosuid,noexec,nodev if grep -q devtmpfs /proc/filesystems 2>/dev/null; then diff --git a/install/base b/install/base index e85551c..9135ced 100644 --- a/install/base +++ b/install/base @@ -1,10 +1,13 @@ #!/bin/bash build() { - for dir in proc sys dev run usr/{bin,sbin}; do + for dir in proc sys dev run usr/{bin,sbin} new_root; do add_dir "/$dir" done + # install busybox's applets as symlinks + /lib/initcpio/busybox --install -s "$BUILDROOT/usr/bin" + add_binary /lib/initcpio/busybox /bin/busybox add_binary /sbin/modprobe add_binary /sbin/blkid -- 1.7.6.4
On Mon, Sep 26, 2011 at 8:22 PM, Dave Reisner <d@falconindy.com> wrote:
This is a constant which will never vary based on setup. Do it during the build to save the forks at runtime. And why does/how can new_root get the same treatment? I'm speaking as one trying to be unfamiliar with the guts here, but worth at least mentioning in the commit message so it doesn't look unintentional.
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- init | 4 ---- install/base | 5 ++++- 2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/init b/init index f14261d..8891a69 100644 --- a/init +++ b/init @@ -1,12 +1,8 @@ #!/bin/busybox ash -# Install busybox's applets as symlinks PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
-busybox --install -s - . /init_functions
-mkdir -p /new_root mount -t proc proc /proc -o nosuid,noexec,nodev mount -t sysfs sys /sys -o nosuid,noexec,nodev if grep -q devtmpfs /proc/filesystems 2>/dev/null; then diff --git a/install/base b/install/base index e85551c..9135ced 100644 --- a/install/base +++ b/install/base @@ -1,10 +1,13 @@ #!/bin/bash
build() { - for dir in proc sys dev run usr/{bin,sbin}; do + for dir in proc sys dev run usr/{bin,sbin} new_root; do add_dir "/$dir" done
+ # install busybox's applets as symlinks + /lib/initcpio/busybox --install -s "$BUILDROOT/usr/bin" + add_binary /lib/initcpio/busybox /bin/busybox add_binary /sbin/modprobe add_binary /sbin/blkid -- 1.7.6.4
On Tue, Sep 27, 2011 at 3:22 AM, Dave Reisner <d@falconindy.com> wrote:
This is a constant which will never vary based on setup. Do it during the build to save the forks at runtime.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Acked-by: Tom Gundersen <teg@jklm.no> BUT: Not that this might cause issues with the next release of busybox. They have changed things in evil ways and don't seem to want to revert it. A foolproof way to solve the problem is to loop over the list of apps (which busybox will give you) and create the symlinks manually. The downside of that is that all links will end up in the same dir, but the distinctions between {,/usr}/{,s}bin don't make any sense in an initramfs anyway, so that should be fine.
--- init | 4 ---- install/base | 5 ++++- 2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/init b/init index f14261d..8891a69 100644 --- a/init +++ b/init @@ -1,12 +1,8 @@ #!/bin/busybox ash -# Install busybox's applets as symlinks PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
-busybox --install -s - . /init_functions
-mkdir -p /new_root mount -t proc proc /proc -o nosuid,noexec,nodev mount -t sysfs sys /sys -o nosuid,noexec,nodev if grep -q devtmpfs /proc/filesystems 2>/dev/null; then diff --git a/install/base b/install/base index e85551c..9135ced 100644 --- a/install/base +++ b/install/base @@ -1,10 +1,13 @@ #!/bin/bash
build() { - for dir in proc sys dev run usr/{bin,sbin}; do + for dir in proc sys dev run usr/{bin,sbin} new_root; do add_dir "/$dir" done
+ # install busybox's applets as symlinks + /lib/initcpio/busybox --install -s "$BUILDROOT/usr/bin" + add_binary /lib/initcpio/busybox /bin/busybox add_binary /sbin/modprobe add_binary /sbin/blkid -- 1.7.6.4
On Tue, Sep 27, 2011 at 11:41:31AM +0200, Tom Gundersen wrote:
On Tue, Sep 27, 2011 at 3:22 AM, Dave Reisner <d@falconindy.com> wrote:
This is a constant which will never vary based on setup. Do it during the build to save the forks at runtime.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Acked-by: Tom Gundersen <teg@jklm.no>
BUT:
Not that this might cause issues with the next release of busybox. They have changed things in evil ways and don't seem to want to revert it.
A foolproof way to solve the problem is to loop over the list of apps (which busybox will give you) and create the symlinks manually.
The downside of that is that all links will end up in the same dir, but the distinctions between {,/usr}/{,s}bin don't make any sense in an initramfs anyway, so that should be fine.
Yeah, I recall you mentioning this. I don't want to make a change that's going to potentially break in the future because of upstream. I'm inclined to sit on this bit of patchwork and push it to my working branch until busybox figures out wtf it is they're going to mangle next. We're not making any radical changes here -- what we have right now works, and this is really only to avoid a few forks at bootstrap. Regardless, you're right that looping over the included applet list is a better way to do this. I think that it's also advantageous because then we can symlink everything into /bin and let user overrides take place in /usr, without having to involve /usr/local (which is a bit odd, imo). d
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- lsinitcpio | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lsinitcpio b/lsinitcpio index ca2b224..95c0500 100755 --- a/lsinitcpio +++ b/lsinitcpio @@ -62,7 +62,7 @@ shift $(( OPTIND - 1 )) declare image=$1 -if [[ -t 2 ]] && (( color )); then +if [[ -t 1 ]] && (( color )); then # prefer terminal safe colored and bold text when tput is supported if tput setaf 0 &>/dev/null; then NC="$(tput sgr0)" -- 1.7.6.4
On Mon, Sep 26, 2011 at 8:22 PM, Dave Reisner <d@falconindy.com> wrote:
Signed-off-by: Dave Reisner <dreisner@archlinux.org> Why were we using stderr before? Did something else change?
--- lsinitcpio | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lsinitcpio b/lsinitcpio index ca2b224..95c0500 100755 --- a/lsinitcpio +++ b/lsinitcpio @@ -62,7 +62,7 @@ shift $(( OPTIND - 1 ))
declare image=$1
-if [[ -t 2 ]] && (( color )); then +if [[ -t 1 ]] && (( color )); then # prefer terminal safe colored and bold text when tput is supported if tput setaf 0 &>/dev/null; then NC="$(tput sgr0)" -- 1.7.6.4
On Mon, Sep 26, 2011 at 08:57:40PM -0500, Dan McGee wrote:
On Mon, Sep 26, 2011 at 8:22 PM, Dave Reisner <d@falconindy.com> wrote:
Signed-off-by: Dave Reisner <dreisner@archlinux.org> Why were we using stderr before? Did something else change?
You really wanna know? Copy/paste job from makepkg. We should fix this over in makepkg as well. I'm not sure why it's used there either.
--- lsinitcpio | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lsinitcpio b/lsinitcpio index ca2b224..95c0500 100755 --- a/lsinitcpio +++ b/lsinitcpio @@ -62,7 +62,7 @@ shift $(( OPTIND - 1 ))
declare image=$1
-if [[ -t 2 ]] && (( color )); then +if [[ -t 1 ]] && (( color )); then # prefer terminal safe colored and bold text when tput is supported if tput setaf 0 &>/dev/null; then NC="$(tput sgr0)" -- 1.7.6.4
On Mon, Sep 26, 2011 at 9:01 PM, Dave Reisner <d@falconindy.com> wrote:
On Mon, Sep 26, 2011 at 08:57:40PM -0500, Dan McGee wrote:
On Mon, Sep 26, 2011 at 8:22 PM, Dave Reisner <d@falconindy.com> wrote:
Signed-off-by: Dave Reisner <dreisner@archlinux.org> Why were we using stderr before? Did something else change?
You really wanna know? Copy/paste job from makepkg. We should fix this over in makepkg as well. I'm not sure why it's used there either.
makepkg -g >> PKGBUILD. Now whether that is a good reason is up for some debate, but you asked. :) -Dan
On Mon, Sep 26, 2011 at 09:05:21PM -0500, Dan McGee wrote:
On Mon, Sep 26, 2011 at 9:01 PM, Dave Reisner <d@falconindy.com> wrote:
On Mon, Sep 26, 2011 at 08:57:40PM -0500, Dan McGee wrote:
On Mon, Sep 26, 2011 at 8:22 PM, Dave Reisner <d@falconindy.com> wrote:
Signed-off-by: Dave Reisner <dreisner@archlinux.org> Why were we using stderr before? Did something else change?
You really wanna know? Copy/paste job from makepkg. We should fix this over in makepkg as well. I'm not sure why it's used there either.
makepkg -g >> PKGBUILD.
Now whether that is a good reason is up for some debate, but you asked. :)
-Dan
Did I say fix? I meant makepkg is wonderful. Yeah, we don't have any such need in lsinitcpio. But, people do enjoy writing the output from this program to a pastebin or a pager, so disabling color on [[ ! -t 1 ]] is the nice thing to do. d
If the image we're pointing to is a symlink, show the resolution as part of the name in -a's output. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- lsinitcpio | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lsinitcpio b/lsinitcpio index 95c0500..4cf4889 100755 --- a/lsinitcpio +++ b/lsinitcpio @@ -86,7 +86,7 @@ readonly NC BOLD BLUE GREEN RED YELLOW [[ -f $image ]] || die "$image: No such file" # read compression type -case "$(file -b "$image")" in +case "$(file -Lb "$image")" in @(data|LZMA)*) compress=lzma ;; gzip*) compress=gzip ;; bzip2*) compress=bzip2 ;; @@ -129,7 +129,9 @@ if (( analyze )); then done # print results - msg 'Image: %s' "$(readlink -e "$image")" + imagename=$image + [[ -L $image ]] && imagename+=" -> $(readlink -e "$image")" + msg 'Image: %s' "$imagename" msg 'Kernel: %s' "${kernver:-unknown}" if [[ $compress ]]; then -- 1.7.6.4
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- functions | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/functions b/functions index 64a1d17..ff061f8 100644 --- a/functions +++ b/functions @@ -108,7 +108,7 @@ _add_symlink() { (( $# == 2 )) || return $EINVAL [[ -L "$BUILDROOT$1" ]] && return $EEXIST - (( QUIET )) || plain "adding symlink: %s -> %s" "$2" "$1" + (( QUIET )) || plain "adding symlink: %s -> %s" "$1" "$2" ln -s "$2" "$BUILDROOT$1" } -- 1.7.6.4
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- mkinitcpio | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/mkinitcpio b/mkinitcpio index 5419d9b..a10ea43 100755 --- a/mkinitcpio +++ b/mkinitcpio @@ -275,7 +275,7 @@ if [[ -z $GENIMG ]]; then else COMPRESSION=${optcompress:-$COMPRESSION} if ! type -P "$COMPRESSION" >/dev/null; then - die "Unable to locate compression method: %s" "$optcompress" + die "Unable to locate compression method: %s" "$COMPRESSION" fi msg "Starting build: %s" "$KERNELVERSION" -- 1.7.6.4
If we encounter a BOOT_IMAGE var taken from grub2, the first character could be a '(' which will throw off busybox's parser and error out. Reverse the comparison so that the LHS is always a constant, which can be compared to anything (including nothing at all). Fixes FS#26119. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- init_functions | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/init_functions b/init_functions index fe29961..edaf87c 100644 --- a/init_functions +++ b/init_functions @@ -45,8 +45,8 @@ parse_cmdline() { # only export stuff that does work with ash :) *=*) rhs="$(echo "${w}" | cut -d= -f2-)" lhs="$(echo "${w}" | cut -d= -f1 | sed 's|\.|_|g;s|-|_|g;')" - if [ "${rhs:0:1}" = "\"" ]; then - if [ "${rhs:$((${#rhs}-1))}" = "\"" ]; then + if [ "\"" = "${rhs:0:1}" = ]; then + if [ "\"" = "${rhs:$((${#rhs}-1))}" ]; then rhs="${rhs:1:$((${#rhs}-2))}" else rhs="${rhs:1}" @@ -61,7 +61,7 @@ parse_cmdline() { ;; esac else - if [ "${w:$((${#w}-1))}" = "\"" ]; then + if [ "\"" = "${w:$((${#w}-1))}" ]; then rhs="${rhs} ${w:0:$((${#w}-1))}" in_quotes=0 (echo "${lhs}" | grep -qe '^[0-9]' -e '[^a-zA-Z0-9_]') || eval ${lhs}=\${rhs} -- 1.7.6.4
On 09/26/2011 10:22 PM, Dave Reisner wrote:
If we encounter a BOOT_IMAGE var taken from grub2, the first character could be a '(' which will throw off busybox's parser and error out. Reverse the comparison so that the LHS is always a constant, which can be compared to anything (including nothing at all).
Fixes FS#26119.
Signed-off-by: Dave Reisner<dreisner@archlinux.org> --- init_functions | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/init_functions b/init_functions index fe29961..edaf87c 100644 --- a/init_functions +++ b/init_functions @@ -45,8 +45,8 @@ parse_cmdline() { # only export stuff that does work with ash :) *=*) rhs="$(echo "${w}" | cut -d= -f2-)" lhs="$(echo "${w}" | cut -d= -f1 | sed 's|\.|_|g;s|-|_|g;')" - if [ "${rhs:0:1}" = "\"" ]; then - if [ "${rhs:$((${#rhs}-1))}" = "\"" ]; then + if [ "\"" = "${rhs:0:1}" = ]; then + if [ "\"" = "${rhs:$((${#rhs}-1))}" ]; then rhs="${rhs:1:$((${#rhs}-2))}" else rhs="${rhs:1}" @@ -61,7 +61,7 @@ parse_cmdline() { ;; esac else - if [ "${w:$((${#w}-1))}" = "\"" ]; then + if [ "\"" = "${w:$((${#w}-1))}" ]; then rhs="${rhs} ${w:0:$((${#w}-1))}" in_quotes=0 (echo "${lhs}" | grep -qe '^[0-9]' -e '[^a-zA-Z0-9_]') || eval ${lhs}=\${rhs}
I testing the whole branch with archiso. But this patch introduced a regression: "ash: =: unknown operand" :: Starting udevd... tracing shows: + echo archisobasedir=arch + lhs=archisobasedir + [ " = a = ] ash: =: unknown operand + echo archisolabel=ARCH_201109 + lhs=archisolabel + [ " = A = ] ash: =: unknown operand + echo initrd=/arch/boot/i686/archiso.img + lhs=initrd + [ " = / = ] ash: =: unknown operand etc -- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
Am 27.09.2011 06:23, schrieb Gerardo Exequiel Pozzi:
- if [ "${rhs:0:1}" = "\"" ]; then + if [ "\"" = "${rhs:0:1}" = ]; then
I testing the whole branch with archiso. But this patch introduced a regression:
"ash: =: unknown operand" :: Starting udevd...
tracing shows:
+ echo archisobasedir=arch + lhs=archisobasedir + [ " = a = ] ash: =: unknown operand
It's typo. When you see it, you will cry.
On 09/27/2011 06:51 AM, Thomas Bächler wrote:
Am 27.09.2011 06:23, schrieb Gerardo Exequiel Pozzi:
- if [ "${rhs:0:1}" = "\"" ]; then + if [ "\"" = "${rhs:0:1}" = ]; then I testing the whole branch with archiso. But this patch introduced a regression:
"ash: =: unknown operand" :: Starting udevd...
tracing shows:
+ echo archisobasedir=arch + lhs=archisobasedir + [ " = a = ] ash: =: unknown operand It's typo. When you see it, you will cry.
haha, I see :P -- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
From: Florian Pritz <bluewind@xinu.at> If you run make dist, extract that tarball somewhere else and try to run makepkg it will fail because it can't find the git tree anymore. [Dave: removed --dirty flag, as this breaks makepkg] Signed-off-by: Florian Pritz <bluewind@xinu.at> --- Makefile | 7 +++++-- PKGBUILD | 4 +--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 18df47f..1a3a815 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # Makefile for mkinitcpio -VERSION = $(shell if test -f VERSION; then cat VERSION; else git describe; fi) +VERSION = $(shell if test -f VERSION; then cat VERSION; else git describe | sed 's/-/./g'; fi) DIRS = \ /bin \ @@ -68,4 +68,7 @@ dist: clean doc ${RM} -r mkinitcpio-${VERSION} gzip -9 mkinitcpio-${VERSION}.tar -.PHONY: clean dist install tarball +version: + @echo ${VERSION} + +.PHONY: clean dist install tarball version diff --git a/PKGBUILD b/PKGBUILD index 2cb6a6d..b5a3217 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,7 +1,5 @@ -IFS='-' read -r major minor _ < <(git describe) - pkgname=mkinitcpio-git -pkgver=$major.$minor +pkgver=$(make version) pkgrel=1 pkgdesc="Modular initramfs image creation utility" arch=(any) -- 1.7.6.4
participants (5)
-
Dan McGee
-
Dave Reisner
-
Gerardo Exequiel Pozzi
-
Thomas Bächler
-
Tom Gundersen