=================================================================== RCS file: /cvs/openbsd/fw_update/fw_install.sh,v retrieving revision 1.86 retrieving revision 1.87 diff -u -r1.86 -r1.87 --- openbsd/fw_update/fw_install.sh 2021/12/18 22:08:04 1.86 +++ openbsd/fw_update/fw_install.sh 2021/12/18 23:02:20 1.87 @@ -1,5 +1,5 @@ #!/bin/ksh -# $OpenBSD: fw_install.sh,v 1.86 2021/12/18 22:08:04 afresh1 Exp $ +# $OpenBSD: fw_install.sh,v 1.87 2021/12/18 23:02:20 afresh1 Exp $ # # Copyright (c) 2021 Andrew Hewus Fresh # @@ -34,6 +34,8 @@ FWURL=http://firmware.openbsd.org/firmware/${HTTP_FWDIR} FWPUB_KEY=${DESTDIR}/etc/signify/openbsd-${VERSION}-fw.pub +DOWNLOAD=true +INSTALL=true LOCALSRC= tmpdir() { @@ -219,28 +221,35 @@ } usage() { - echo "usage: fw_install [-DL] [driver | file [...]]" + echo "usage: fw_install [-D | -L] [driver | file [...]]" exit 2 } -INSTALL=true -DOWNLOAD=true - +OPT_D= +OPT_L= while getopts DL name do case "$name" in - # "download only" means local dir and don't install - D) LOCALSRC=. INSTALL=false ;; - L) LOCALSRC=. ;; + D) OPT_D=true ;; + L) OPT_L=true ;; ?) usage 2 ;; esac done shift $((OPTIND - 1)) -# If we're installing from a local dir -# we don't want to download anything -[ "$LOCALSRC" ] && "$INSTALL" && DOWNLOAD=false -[ "$LOCALSRC" ] || LOCALSRC="$( tmpdir "${DESTDIR}/tmp/fw_install" )" +[ "$OPT_D" ] && [ "$OPT_L" ] && usage 1 + +if [ "$OPT_D" ]; then + # "Download only" means local dir and don't install + INSTALL=false + LOCALSRC=. +elif [ "$OPT_L" ]; then + # "Local" means don't download, install from local dir + DOWNLOAD=false + LOCALSRC=. +else + LOCALSRC="$( tmpdir "${DESTDIR}/tmp/fw_install" )" +fi CFILE="$LOCALSRC/$CFILE"