Cleanup usage()

This commit is contained in:
2026-05-12 10:43:23 -04:00
parent ec8fb8f960
commit 2d83b552c7

View File

@@ -1,25 +1,25 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Build and deploy OpenWRT images using shell-style device profiles, via source code or the official Image Builder. # Build and deploy OpenWRT images using shell-style device profiles, via source code or the official Image Builder.
# Copyright 2022-25 Bryan C. Roessler # Copyright 2022-26 Bryan C. Roessler
# Apache 2.0 License # Apache 2.0 License
# See README and ./profiles for device configuration # See README and ./profiles for device configuration
# Set default release # Set default release
: "${DEFAULT_RELEASE:=${RELEASE:="25.12.3"}}" : "${DEFAULT_RELEASE:=${RELEASE:="25.12.3"}}" # do find all replace
# @internal # @internal
print_help() { usage() {
debug "${FUNCNAME[0]}" debug "${FUNCNAME[0]}"
cat <<-'EOF' cat <<-'EOF'
Build and deploy OpenWRT images using convenient profiles. Build and deploy OpenWRT images using convenient profiles.
USAGE: USAGE:
openwrtbuilder [OPTION [VALUE]]... -p PROFILE [-p PROFILE]... openwrtbuilder [OPTIONS] [-p PROFILE]...
OPTIONS OPTIONS
--profile,-p PROFILE --profile,-p PROFILE
--release,-r,--version,-v RELEASE ("snapshot", "24.10.5") --release,-r,--version,-v RELEASE ("snapshot", "25.12.3")
Default: From profile or hardcoded RELEASE Default: From profile or hardcoded RELEASE
--buildroot,-b PATH --buildroot,-b PATH
Default: location of openwrtbuilder script Default: location of openwrtbuilder script
@@ -45,7 +45,7 @@ print_help() {
EXAMPLES EXAMPLES
openwrtbuilder -p r4s -r snapshot openwrtbuilder -p r4s -r snapshot
openwrtbuilder -p ax6000 -r 23.05.0-rc3 --mode source --debug openwrtbuilder -p ax6000 -r 23.05.0-rc3 --mode source --debug
openwrtbuilder -p rpi4 -r 24.10.0 --flash /dev/sdX openwrtbuilder -p rpi4 -r 25.12.3 --flash /dev/sdX
openwrtbuilder -p linksys -r snapshot --ssh-upgrade root@192.168.1.1 openwrtbuilder -p linksys -r snapshot --ssh-upgrade root@192.168.1.1
EOF EOF
} }
@@ -66,7 +66,7 @@ init() {
else else
echo "/etc/os-release not found" echo "/etc/os-release not found"
echo "Your OS is unsupported" echo "Your OS is unsupported"
print_help usage
exit 1 exit 1
fi fi
@@ -149,14 +149,14 @@ parse_input() {
--depends) FORCE_DEPENDS=1 ;; --depends) FORCE_DEPENDS=1 ;;
--yes|-y) YES=1 ;; --yes|-y) YES=1 ;;
--debug|-d) echo "Debugging on"; DEBUG=1 ;; --debug|-d) echo "Debugging on"; DEBUG=1 ;;
--help|-h) print_help; exit 0 ;; --help|-h) usage; exit 0 ;;
--) shift; break ;; --) shift; break ;;
esac esac
shift shift
done done
else else
echo "Incorrect options provided" echo "Incorrect options provided"
print_help; exit 1 usage; exit 1
fi fi
} }