Skip to content

Commit d16e3a6

Browse files
ajdlinuxa-nogikh
authored andcommitted
tools/create-image.sh: improve help message
Improve the help message: - sort options alphabetically - print default values - print first line to stdout like the rest of the message - fix typos, improve style Also sort the options parsing to be alphabetical (except --help), and use spaces consistently for indentation in this section. Signed-off-by: Andrew Donnellan <[email protected]>
1 parent d6d0fde commit d16e3a6

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

tools/create-image.sh

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,47 +23,47 @@ PERF=false
2323

2424
# Display help function
2525
display_help() {
26-
echo "Usage: $0 [option...] " >&2
26+
echo "Usage: $0 [option...] "
2727
echo
28-
echo " -a, --arch Set architecture"
29-
echo " -d, --distribution Set on which debian distribution to create"
30-
echo " -f, --feature Check what packages to install in the image, options are minimal, full"
31-
echo " -s, --seek Image size (MB), default 2048 (2G)"
28+
echo " -a, --arch Set architecture (default: $ARCH)"
29+
echo " -d, --distribution Set on which Debian distribution to create (default: $RELEASE)"
30+
echo " -f, --feature Check what packages to install in the image, options are minimal, full (default: $FEATURE)"
3231
echo " -h, --help Display help message"
33-
echo " -p, --add-perf Add perf support with this option enabled. Please set envrionment variable \$KERNEL at first"
32+
echo " -p, --add-perf Add perf support. Requires environment variable \$KERNEL pointing to kernel source tree"
33+
echo " -s, --seek Image size in MB (default: $(($SEEK + 1)))"
3434
echo
3535
}
3636

3737
while true; do
3838
if [ $# -eq 0 ];then
39-
echo $#
40-
break
39+
echo $#
40+
break
4141
fi
4242
case "$1" in
4343
-h | --help)
4444
display_help
4545
exit 0
4646
;;
4747
-a | --arch)
48-
ARCH=$2
48+
ARCH=$2
4949
shift 2
5050
;;
5151
-d | --distribution)
52-
RELEASE=$2
52+
RELEASE=$2
5353
shift 2
5454
;;
5555
-f | --feature)
56-
FEATURE=$2
57-
shift 2
58-
;;
59-
-s | --seek)
60-
SEEK=$(($2 - 1))
56+
FEATURE=$2
6157
shift 2
6258
;;
6359
-p | --add-perf)
64-
PERF=true
60+
PERF=true
6561
shift 1
6662
;;
63+
-s | --seek)
64+
SEEK=$(($2 - 1))
65+
shift 2
66+
;;
6767
-*)
6868
echo "Error: Unknown option: $1" >&2
6969
exit 1

0 commit comments

Comments
 (0)