[arch-projects] [mkinitcpio][PATCH 06/26] functions: allow ignoring errors on module addition

Dan McGee dpmcgee at gmail.com
Mon Sep 26 23:17:35 EDT 2011


On Monday, September 26, 2011, Dave Reisner <d at 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 at 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


More information about the arch-projects mailing list