| version 1.110, 2021/12/23 19:48:55 |
version 1.111, 2021/12/23 20:25:40 |
|
|
| FWPUB_KEY=${DESTDIR}/etc/signify/openbsd-${VERSION}-fw.pub |
FWPUB_KEY=${DESTDIR}/etc/signify/openbsd-${VERSION}-fw.pub |
| |
|
| VERBOSE=false |
VERBOSE=false |
| |
DELETE=false |
| DOWNLOAD=true |
DOWNLOAD=true |
| INSTALL=true |
INSTALL=true |
| LOCALSRC= |
LOCALSRC= |
|
|
| } |
} |
| |
|
| usage() { |
usage() { |
| echo "usage: ${0##*/} [-D | -L] [-v] [driver | file ...]" |
echo "usage: ${0##*/} [-d | -D | -L] [-v] [driver | file ...]" |
| exit 2 |
exit 2 |
| } |
} |
| |
|
| OPT_D= |
OPT_D= |
| OPT_L= |
OPT_L= |
| while getopts :DLv name |
while getopts :dDLv name |
| do |
do |
| case "$name" in |
case "$name" in |
| |
d) DELETE=true ;; |
| D) OPT_D=true ;; |
D) OPT_D=true ;; |
| L) OPT_L=true ;; |
L) OPT_L=true ;; |
| v) VERBOSE=true ;; |
v) VERBOSE=true ;; |
|
|
| |
|
| CFILE="$LOCALSRC/$CFILE" |
CFILE="$LOCALSRC/$CFILE" |
| |
|
| if "$INSTALL" && [ -x /usr/bin/id ] && [ "$(/usr/bin/id -u)" != 0 ]; then |
if "$INSTALL" || "$DELETE"; then |
| echo "need root privileges" >&2 |
if [ -x /usr/bin/id ] && [ "$(/usr/bin/id -u)" != 0 ]; then |
| exit 1 |
echo "need root privileges" >&2 |
| |
exit 1 |
| |
fi |
| fi |
fi |
| |
|
| set -A devices -- "$@" |
set -A devices -- "$@" |
| |
|
| |
if "$DELETE"; then |
| |
[ "$OPT_D" ] || [ "$OPT_L" ] && usage 22 |
| |
|
| |
[ "${devices[*]:-}" ] || usage 22 |
| |
|
| |
deleted='' |
| |
for d in "${devices[@]}"; do |
| |
f="${d##*/}" # don't just uninstall from anywhere |
| |
f="${f%.tgz}" # allow specifying the package name |
| |
|
| |
set -A installed -- $( installed_firmware '' "$f" '*' ) |
| |
|
| |
if [ ! "${installed[*]:-}" ]; then |
| |
echo "No firmware found for '$d'" >&2 |
| |
continue |
| |
fi |
| |
|
| |
for fw in "${installed[@]}"; do |
| |
delete_firmware "$fw" || continue |
| |
deleted="$deleted,$fw" |
| |
done |
| |
done |
| |
|
| |
deleted="${deleted:+${deleted#,}}" |
| |
echo "${0:##*/}: deleted ${deleted:-none}"; |
| |
|
| |
exit |
| |
fi |
| |
|
| if [ ! "${devices[*]:-}" ]; then |
if [ ! "${devices[*]:-}" ]; then |
| "$VERBOSE" && echo -n "Detecting firmware ..." |
"$VERBOSE" && echo -n "Detecting firmware ..." |