diff options
| author | Bjoern A. Zeeb <bz@FreeBSD.org> | 2024-11-04 23:59:58 +0000 |
|---|---|---|
| committer | Bjoern A. Zeeb <bz@FreeBSD.org> | 2024-11-08 18:13:54 +0000 |
| commit | 1eb3f15c149b9a2e5b6f5e10aed454fc85945bbd (patch) | |
| tree | f5e8ff5c8957468a97d184a9a3c31ecc0e268cea | |
| parent | 52f8e99e7e5e6fab52b3fff535d62b873f8c02dd (diff) | |
| -rwxr-xr-x[-rw-r--r--] | usr.sbin/fwget/fwget.sh | 48 |
1 files changed, 33 insertions, 15 deletions
diff --git a/usr.sbin/fwget/fwget.sh b/usr.sbin/fwget/fwget.sh index 154fb7dc92e1..3e2181e53b73 100644..100755 --- a/usr.sbin/fwget/fwget.sh +++ b/usr.sbin/fwget/fwget.sh @@ -38,7 +38,8 @@ Supported subsystems pci Options: - -n -- Do not install package, only print the results + -n -- Do not install packages, only print the results + -q -- Quiet mode. If used with -n only prints a package a line -v -- More verbose EOF exit 1 @@ -75,22 +76,27 @@ addpkg() } DRY_RUN=n +QUIET=n VERBOSE=n -while [ $# -gt 0 ]; do - case $1 in - -n) - DRY_RUN=y - ;; - -v) - VERBOSE=y - ;; - *) - subsystems="${subsystems} $1" - ;; +while getopts ":nqv" _arg; do + case ${_arg} in + n) + DRY_RUN=y + ;; + q) + QUIET=y + ;; + v) + VERBOSE=y + ;; + ?) + usage + ;; esac - shift done +shift $(($OPTIND - 1)) +subsystems="$@" # Default searching PCI subsystem if [ -z "${subsystems}" ]; then @@ -112,13 +118,25 @@ done case "${packages}" in ""|^[[:space:]]*$) - echo "No firmware packages to install." + if [ "${QUIET}" != "y" ]; then + echo "No firmware packages to install." + fi exit 0 ;; esac -echo "Needed firmware packages: '${packages}'" +if [ "${QUIET}" != "y" ]; then + echo "Needed firmware packages: '${packages}'" +fi if [ "${DRY_RUN}" = "y" ]; then + if [ "${QUIET}" = "y" ]; then + for pkg in ${packages}; do + case "${pkg}" in + ""|^[[:space:]]*$) continue ;; + esac + echo "${pkg}" + done + fi exit 0 fi |
