Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/postinstall postinstall: help to stdout. usage tweaks
details: https://anonhg.NetBSD.org/src/rev/d1ee18f8426e
branches: trunk
changeset: 359504:d1ee18f8426e
user: lukem <lukem%NetBSD.org@localhost>
date: Sat Jan 08 06:53:58 2022 +0000
description:
postinstall: help to stdout. usage tweaks
When invoked as "help" or "usage", send the usage to stdout
instead of stderr, so that it's easier to pipe to a pager.
Explicitly warn that the operation is missing.
Tweak the usage; "operation" instead of "op", no need for [] around ...
diffstat:
usr.sbin/postinstall/postinstall.in | 24 ++++++++++++++++--------
1 files changed, 16 insertions(+), 8 deletions(-)
diffs (70 lines):
diff -r cb01844da8e3 -r d1ee18f8426e usr.sbin/postinstall/postinstall.in
--- a/usr.sbin/postinstall/postinstall.in Sat Jan 08 02:00:49 2022 +0000
+++ b/usr.sbin/postinstall/postinstall.in Sat Jan 08 06:53:58 2022 +0000
@@ -1,8 +1,8 @@
#!/bin/sh
#
-# $NetBSD: postinstall.in,v 1.42 2022/01/07 01:03:02 lukem Exp $
+# $NetBSD: postinstall.in,v 1.43 2022/01/08 06:53:58 lukem Exp $
#
-# Copyright (c) 2002-2021 The NetBSD Foundation, Inc.
+# Copyright (c) 2002-2022 The NetBSD Foundation, Inc.
# All rights reserved.
#
# This code is derived from software contributed to The NetBSD Foundation
@@ -2538,10 +2538,10 @@
#
-usage()
+help()
{
- cat 1>&2 << _USAGE_
-Usage: ${PROGNAME} [-s srcdir] [-x xsrcdir] [-d destdir] [-m mach] [-a arch] op [item [...]]
+ cat << _USAGE_
+Usage: ${PROGNAME} [-s srcdir] [-x xsrcdir] [-d destdir] [-m mach] [-a arch] operation [item ...]
Perform post-installation checks and/or fixes on a system's
configuration files.
If no items are provided, a default set of checks or fixes is applied.
@@ -2564,7 +2564,7 @@
-m mach MACHINE. [${MACHINE}]
-a arch MACHINE_ARCH. [${MACHINE_ARCH}]
- Operation may be one of:
+ Supported values for operation:
help Display this help.
list List available items.
check Perform post-installation checks on items.
@@ -2573,6 +2573,11 @@
fix Apply fixes that 'check' determines need to be applied.
usage Display this usage.
_USAGE_
+}
+
+usage()
+{
+ help 1>&2
exit 2
}
@@ -2673,7 +2678,10 @@
esac
done
shift $((${OPTIND} - 1))
- [ $# -gt 0 ] || usage
+ if [ $# -eq 0 ] ; then
+ warn "Missing operation"
+ usage
+ fi
if [ "$N_SRC_ARGS" -gt 1 ] && $DIRMODE; then
err 2 "Multiple -s args are allowed only with tgz files"
@@ -2759,7 +2767,7 @@
case "${op}" in
usage|help)
- usage
+ help
;;
list)
Home |
Main Index |
Thread Index |
Old Index