From c82cb4f416c184954f4e3429288a41a4f53b4089 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Thu, 12 May 2022 15:46:35 +0200 Subject: update-kernel: fix usage help text send it to stdout with -h --- update-kernel.in | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/update-kernel.in b/update-kernel.in index a995de5..85dcb17 100644 --- a/update-kernel.in +++ b/update-kernel.in @@ -9,7 +9,8 @@ # Copyright (c) 2014-2021 Kaarle Ritvanen PREFIX=@PREFIX@ -. $PREFIX/lib/libalpine.sh +: ${LIBDIR=$PREFIX/lib} +. "$LIBDIR/libalpine.sh" SCRIPT=update-kernel VIRTUAL=.tmp-$SCRIPT @@ -39,14 +40,16 @@ error() { } usage() { - [ "$2" ] && error "$2" + [ "$2" ] && error "$2" $outfh local opts="[-F ]... [-p ]..." local dest_args="[-a ] " - cat >&2 <<-__EOF__ + local outfh=2 + [ $1 -eq 0 ] && outfh=1 + cat >&$outfh <<-__EOF__ - Syntax: $SCRIPT $opts [$dest_args] - $SCRIPT -f $opts $dest_args - $SCRIPT -b $opts [$dest_args] + usage: $SCRIPT $opts [$dest_args] + $SCRIPT -f $opts $dest_args + $SCRIPT -b $opts [$dest_args] Options: -a|--arch Install kernel for specified architecture -b|--build-dir Install custom-built kernel @@ -98,7 +101,7 @@ while :; do modloopfw="$modloopfw $1" ;; -h|--help) - echo "$SCRIPT @VERSION@" >&2 + echo "$SCRIPT @VERSION@" usage 0 ;; -p|--package) -- cgit v1.2.3