aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2014-11-02 23:06:08 +0200
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2014-11-02 23:09:11 +0200
commit2c30048a65b6eff35bc5017b7ad0aa452d87e8a4 (patch)
tree4dc2b91b1e5b1a7c9f2358071b7bd5145f9130e2
parentf9650395728287a13570ff5bb9de76727c228fb4 (diff)
downloadalpine-conf-2c30048a65b6eff35bc5017b7ad0aa452d87e8a4.tar.bz2
alpine-conf-2c30048a65b6eff35bc5017b7ad0aa452d87e8a4.tar.xz
update-kernel: help on usage
-rw-r--r--update-kernel.in44
1 files changed, 34 insertions, 10 deletions
diff --git a/update-kernel.in b/update-kernel.in
index 9344dd8..f30ca97 100644
--- a/update-kernel.in
+++ b/update-kernel.in
@@ -20,8 +20,30 @@ SIGNALS="HUP INT TERM"
TMPDIR=
features=
-OPTS=$(getopt -l build-dir:,flavor:,feature:,package: -n $SCRIPT -o b:f:F:p: \
- -- "$@")
+error() {
+ echo "$SCRIPT: $1" >&2
+}
+
+usage() {
+ [ "$2" ] && error "$2"
+ local opts="[-F <feature>]... [-p <package>]..."
+ cat >&2 <<EOF
+
+Syntax: $SCRIPT $opts [<dest_dir>]
+ $SCRIPT -f <flavor> $opts <dest_dir>
+ $SCRIPT -b <build_dir> $opts [<dest_dir>]
+
+Options: -b|--build <build_dir> Install custom-built kernel
+ -f|--flavor <flavor> Install kernel of specified flavor
+ -F|--feature <feature> Enable initfs feature
+ -p|--package <package> Additional module or firmware package
+
+EOF
+ exit $1
+}
+
+OPTS=$(getopt -l build-dir:,flavor:,feature:,help,package: -n $SCRIPT \
+ -o b:f:F:hp: -- "$@") || usage 1
eval set -- "$OPTS"
while :; do
case "$1" in
@@ -34,6 +56,9 @@ while :; do
-F|--feature)
features="$features $2"
;;
+ -h|--help)
+ usage 0
+ ;;
-p|--package)
PACKAGES="$PACKAGES $2"
;;
@@ -47,16 +72,12 @@ done
DESTDIR=$2
-error() {
- echo "$1" >&2
- exit 1
-}
-
[ "$BUILDDIR" -a "$FLAVOR" ] && \
- error "Cannot specify both build directory and flavor"
+ usage 1 "Cannot specify both build directory and flavor"
if [ -z "$DESTDIR" ]; then
- [ "$FLAVOR" ] && error "Cannot specify flavor when updating the current kernel"
+ [ "$FLAVOR" ] && \
+ usage 1 "Cannot specify flavor when updating the current kernel"
while read MOUNT; do
set -- $MOUNT
@@ -66,7 +87,10 @@ if [ -z "$DESTDIR" ]; then
break
done < /proc/mounts
- [ "$MNTDIR" ] || error "Module loopback device not mounted"
+ if [ -z "$MNTDIR" ]; then
+ error "Module loopback device not mounted"
+ exit 1
+ fi
fi
remount() {