| version 1.130, 2021/12/25 18:22:38 |
version 1.131, 2021/12/25 19:03:56 |
|
|
| FWURL=http://firmware.openbsd.org/firmware/${HTTP_FWDIR} |
FWURL=http://firmware.openbsd.org/firmware/${HTTP_FWDIR} |
| FWPUB_KEY=${DESTDIR}/etc/signify/openbsd-${VERSION}-fw.pub |
FWPUB_KEY=${DESTDIR}/etc/signify/openbsd-${VERSION}-fw.pub |
| |
|
| |
DRYRUN=false |
| VERBOSE=false |
VERBOSE=false |
| DELETE=false |
DELETE=false |
| DOWNLOAD=true |
DOWNLOAD=true |
|
|
| |
|
| ALL=false |
ALL=false |
| OPT_D= |
OPT_D= |
| while getopts :adDp:v name |
while getopts :adDnp:v name |
| do |
do |
| case "$name" in |
case "$name" in |
| a) ALL=true ;; |
a) ALL=true ;; |
| d) DELETE=true ;; |
d) DELETE=true ;; |
| D) OPT_D=true ;; |
D) OPT_D=true ;; |
| |
n) DRYRUN=true ;; |
| p) LOCALSRC="$OPTARG" ;; |
p) LOCALSRC="$OPTARG" ;; |
| v) VERBOSE=true ;; |
v) VERBOSE=true ;; |
| :) |
:) |
|
|
| deleted='' |
deleted='' |
| if [ "${installed:-}" ]; then |
if [ "${installed:-}" ]; then |
| for fw in "${installed[@]}"; do |
for fw in "${installed[@]}"; do |
| delete_firmware "$fw" || continue |
if "$DRYRUN"; then |
| |
echo "Delete $fw" |
| |
else |
| |
delete_firmware "$fw" || continue |
| |
fi |
| deleted="$deleted,$( firmware_devicename "$fw" )" |
deleted="$deleted,$( firmware_devicename "$fw" )" |
| done |
done |
| fi |
fi |
|
|
| if "$INSTALL" && [ "${installed[*]:-}" ]; then |
if "$INSTALL" && [ "${installed[*]:-}" ]; then |
| for i in "${installed[@]}"; do |
for i in "${installed[@]}"; do |
| if [ "${f##*/}" = "$i.tgz" ]; then |
if [ "${f##*/}" = "$i.tgz" ]; then |
| "$VERBOSE" && echo "$i already installed" |
"$VERBOSE" && echo "Keep $i" |
| kept="$kept,$d" |
kept="$kept,$d" |
| continue 2 |
continue 2 |
| fi |
fi |
|
|
| |
|
| if [ -e "$f" ]; then |
if [ -e "$f" ]; then |
| if "$DOWNLOAD"; then |
if "$DOWNLOAD"; then |
| "$VERBOSE" && echo "Verify existing ${f##*/}" |
if "$VERBOSE"; then |
| verify "$f" || continue |
"$INSTALL" && |
| "$INSTALL" || kept="$kept,$d" |
echo "Verify ${f##*/}" || |
| |
echo "Keep/Verify ${f##*/}" |
| |
echo "Verify ${f##*/}" |
| |
fi |
| |
"$DRYRUN" || verify "$f" || continue |
| |
"$INSTALL" || kept="$kept,$d" |
| # else assume it was verified when downloaded |
# else assume it was verified when downloaded |
| fi |
fi |
| elif "$DOWNLOAD"; then |
elif "$DOWNLOAD"; then |
| fetch "$f" || continue |
if "$DRYRUN"; then |
| verify "$f" || continue |
"$VERBOSE" && echo "Get/Verify ${f##*/}" |
| |
else |
| |
fetch "$f" || continue |
| |
verify "$f" || continue |
| |
fi |
| "$INSTALL" || added="$added,$d" |
"$INSTALL" || added="$added,$d" |
| elif "$INSTALL"; then |
elif "$INSTALL"; then |
| echo "Cannot install ${f##*/}, not found" >&2 |
echo "Cannot install ${f##*/}, not found" >&2 |
|
|
| removed=false |
removed=false |
| if [ "${installed[*]:-}" ]; then |
if [ "${installed[*]:-}" ]; then |
| for i in "${installed[@]}"; do |
for i in "${installed[@]}"; do |
| delete_firmware "$i" |
"$DRYRUN" || delete_firmware "$i" |
| removed=true |
removed=true |
| done |
done |
| fi |
fi |
| |
|
| add_firmware "$f" |
"$DRYRUN" || add_firmware "$f" |
| |
|
| |
f="${f##*/}" |
| |
f="${f%.tgz}" |
| if "$removed"; then |
if "$removed"; then |
| |
"$DRYRUN" && echo "Update $f" |
| updated="$updated,$d" |
updated="$updated,$d" |
| else |
else |
| |
"$DRYRUN" && echo "Install $f" |
| added="$added,$d" |
added="$added,$d" |
| fi |
fi |
| done |
done |