Annotation of openbsd/fw_update/fw_install.sh, Revision 1.148
1.1 afresh1 1: #!/bin/ksh
1.36 afresh1 2: # $OpenBSD$
1.50 afresh1 3: #
1.38 afresh1 4: # Copyright (c) 2021 Andrew Hewus Fresh <afresh1@openbsd.org>
5: #
6: # Permission to use, copy, modify, and distribute this software for any
7: # purpose with or without fee is hereby granted, provided that the above
8: # copyright notice and this permission notice appear in all copies.
9: #
10: # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11: # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12: # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13: # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14: # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15: # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16: # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17:
1.95 afresh1 18: set -o errexit -o pipefail -o nounset -o noclobber -o noglob
1.85 afresh1 19: set +o monitor
1.77 afresh1 20: export PATH=/usr/bin:/bin:/usr/sbin:/sbin
1.50 afresh1 21:
22: CFILE=SHA256.sig
23: DESTDIR=${DESTDIR:-}
24: FWPATTERNS="${DESTDIR}/usr/share/misc/firmware_patterns"
25:
26: VNAME=${VNAME:-$(sysctl -n kern.osrelease)}
27: VERSION=${VERSION:-"${VNAME%.*}${VNAME#*.}"}
28:
29: HTTP_FWDIR="$VNAME"
1.52 afresh1 30: VTYPE=$( sed -n "/^OpenBSD $VNAME\([^ ]*\).*$/s//\1/p" \
31: /var/run/dmesg.boot | sed '$!d' )
1.50 afresh1 32: [[ $VTYPE == -!(stable) ]] && HTTP_FWDIR=snapshots
1.22 afresh1 33:
1.50 afresh1 34: FWURL=http://firmware.openbsd.org/firmware/${HTTP_FWDIR}
35: FWPUB_KEY=${DESTDIR}/etc/signify/openbsd-${VERSION}-fw.pub
1.8 afresh1 36:
1.131 afresh1 37: DRYRUN=false
1.138 afresh1 38: VERBOSE=0
1.111 afresh1 39: DELETE=false
1.144 afresh1 40: DOWNLOAD=true
1.87 afresh1 41: INSTALL=true
1.69 afresh1 42: LOCALSRC=
43:
1.126 afresh1 44: unset FTPPID
1.129 afresh1 45: unset FWPKGTMP
1.126 afresh1 46: REMOVE_LOCALSRC=false
47: cleanup() {
1.127 afresh1 48: set +o errexit # ignore errors from killing ftp
1.128 afresh1 49: [ "${FTPPID:-}" ] && kill -TERM -"$FTPPID" 2>/dev/null
1.129 afresh1 50: [ "${FWPKGTMP:-}" ] && rm -rf "$FWPKGTMP"
1.126 afresh1 51: "$REMOVE_LOCALSRC" && rm -rf "$LOCALSRC"
52: }
53: trap cleanup EXIT
54:
1.8 afresh1 55: tmpdir() {
56: local _i=1 _dir
57:
1.50 afresh1 58: # If we're not in the installer,
1.79 afresh1 59: # we have mktemp and a more hostile environment.
1.50 afresh1 60: if [ -x /usr/bin/mktemp ]; then
61: _dir=$( mktemp -d "${1}-XXXXXXXXX" )
1.44 afresh1 62: else
1.50 afresh1 63: until _dir="${1}.$_i.$RANDOM" && mkdir -- "$_dir" 2>/dev/null; do
1.44 afresh1 64: ((++_i < 10000)) || return 1
65: done
66: fi
1.50 afresh1 67:
1.8 afresh1 68: echo "$_dir"
69: }
1.6 afresh1 70:
1.50 afresh1 71: fetch() {
1.126 afresh1 72: local _src="${FWURL}/${1##*/}" _dst=$1 _user=_file _exit _error=''
1.6 afresh1 73:
1.79 afresh1 74: # If we're not in the installer,
75: # we have su(1) and doas(1) is unlikely to be configured.
1.85 afresh1 76: set -o monitor # make sure ftp gets its own process group
77: (
1.138 afresh1 78: _flags=-vm
79: case "$VERBOSE" in
80: 0|1) _flags=-VM ;;
81: 2) _flags=-Vm ;;
82: esac
1.53 afresh1 83: if [ -x /usr/bin/su ]; then
1.85 afresh1 84: exec /usr/bin/su -s /bin/ksh "$_user" -c \
1.138 afresh1 85: "/usr/bin/ftp -N '${0##/}' -D 'Get/Verify' $_flags -o- '$_src'" > "$_dst"
1.42 afresh1 86: else
1.85 afresh1 87: exec /usr/bin/doas -u "$_user" \
1.138 afresh1 88: /usr/bin/ftp -N "${0##/}" -D 'Get/Verify' $_flags -o- "$_src" > "$_dst"
1.42 afresh1 89: fi
1.126 afresh1 90: ) & FTPPID=$!
1.85 afresh1 91: set +o monitor
92:
93: SECONDS=0
94: _last=0
1.126 afresh1 95: while kill -0 -"$FTPPID" 2>/dev/null; do
1.85 afresh1 96: if [[ $SECONDS -gt 12 ]]; then
97: set -- $( ls -ln "$_dst" 2>/dev/null )
98: if [[ $_last -ne $5 ]]; then
99: _last=$5
100: SECONDS=0
101: sleep 1
102: else
1.137 afresh1 103: kill -INT -"$FTPPID" 2>/dev/null
1.92 afresh1 104: _error=" (timed out)"
1.85 afresh1 105: fi
106: else
107: sleep 1
108: fi
109: done
110:
111: set +o errexit
1.126 afresh1 112: wait "$FTPPID"
1.85 afresh1 113: _exit=$?
114: set -o errexit
115:
1.126 afresh1 116: unset FTPPID
1.6 afresh1 117:
1.50 afresh1 118: if [ "$_exit" -ne 0 ]; then
1.69 afresh1 119: rm -f "$_dst"
1.92 afresh1 120: echo "Cannot fetch $_src$_error" >&2
1.50 afresh1 121: return 1
122: fi
1.146 afresh1 123:
124: return 0
1.6 afresh1 125: }
126:
1.144 afresh1 127: fetch_cfile() {
128: if "$DOWNLOAD"; then
129: set +o noclobber # we want to get the latest CFILE
130: fetch "$CFILE" || return 1
131: set -o noclobber
132: ! signify -qVep "$FWPUB_KEY" -x "$CFILE" -m "$CFILE" &&
133: echo "Signature check of SHA256.sig failed" >&2 && return 1
134: elif [ ! -e "$CFILE" ]; then
135: echo "${0##*/}: $CFILE: No such file or directory" >&2
136: return 2
137: fi
1.146 afresh1 138:
139: return 0
1.144 afresh1 140: }
141:
1.50 afresh1 142: verify() {
1.146 afresh1 143: [ -e "$CFILE" ] || fetch_cfile || return 1
1.50 afresh1 144: # On the installer we don't get sha256 -C, so fake it.
1.69 afresh1 145: if ! fgrep -qx "SHA256 (${1##*/}) = $( /bin/sha256 -qb "$1" )" "$CFILE"; then
146: echo "Checksum test for ${1##*/} failed." >&2
1.50 afresh1 147: return 1
148: fi
1.146 afresh1 149:
150: return 0
1.6 afresh1 151: }
152:
1.124 afresh1 153: firmware_in_dmesg() {
1.90 afresh1 154: local _d _m _line _dmesgtail _last='' _nl=$( echo )
1.1 afresh1 155:
1.50 afresh1 156: # When we're not in the installer, the dmesg.boot can
157: # contain multiple boots, so only look in the last one
1.133 afresh1 158: _dmesgtail="$( echo ; sed -n 'H;/^OpenBSD/h;${g;p;}' /var/run/dmesg.boot )"
1.50 afresh1 159:
1.89 afresh1 160: grep -v '^[[:space:]]*#' "$FWPATTERNS" |
161: while read -r _d _m; do
162: [ "$_d" = "$_last" ] && continue
1.90 afresh1 163: [ "$_m" ] || _m="${_nl}${_d}[0-9] at "
164: [ "$_m" = "${_m#^}" ] || _m="${_nl}${_m#^}"
1.83 afresh1 165:
1.89 afresh1 166: if [[ $_dmesgtail = *$_m* ]]; then
167: echo "$_d"
168: _last="$_d"
169: fi
170: done
1.50 afresh1 171: }
1.14 afresh1 172:
1.50 afresh1 173: firmware_filename() {
1.56 afresh1 174: local _f
1.146 afresh1 175: [ -e "$CFILE" ] || fetch_cfile || return 1
1.56 afresh1 176: _f="$( sed -n "s/.*(\($1-firmware-.*\.tgz\)).*/\1/p" "$CFILE" | sed '$!d' )"
177: ! [ "$_f" ] && echo "Unable to find firmware for $1" >&2 && return 1
178: echo "$_f"
1.50 afresh1 179: }
1.7 afresh1 180:
1.57 afresh1 181: firmware_devicename() {
182: local _d="${1##*/}"
183: _d="${_d%-firmware-*}"
184: echo "$_d"
185: }
186:
1.50 afresh1 187: installed_firmware() {
1.110 afresh1 188: local _pre="$1" _match="$2" _post="$3" _firmware
1.123 afresh1 189: set -sA _firmware -- $(
1.109 afresh1 190: set +o noglob
191: grep -Fxl '@option firmware' \
1.110 afresh1 192: "${DESTDIR}/var/db/pkg/"$_pre"$_match"$_post"/+CONTENTS" \
1.109 afresh1 193: 2>/dev/null || true
194: set -o noglob
195: )
196:
197: [ "${_firmware[*]:-}" ] || return 0
198: for fw in "${_firmware[@]}"; do
199: fw="${fw%/+CONTENTS}"
1.50 afresh1 200: echo "${fw##*/}"
201: done
202: }
1.1 afresh1 203:
1.124 afresh1 204: detect_firmware() {
205: local _devices _last='' _d
206:
207: set -sA _devices -- $(
208: firmware_in_dmesg
209: for _d in $( installed_firmware '*' '-firmware-' '*' ); do
1.135 afresh1 210: firmware_devicename "$_d"
1.124 afresh1 211: done
212: )
213:
214: [ "${_devices[*]:-}" ] || return 0
215: for _d in "${_devices[@]}"; do
1.135 afresh1 216: [ "$_last" = "$_d" ] && continue
217: echo "$_d"
1.124 afresh1 218: _last="$_d"
219: done
220: }
221:
1.50 afresh1 222: add_firmware () {
1.139 afresh1 223: local _f="${1##*/}" _m="${2:-Install}" _pkgname
1.129 afresh1 224: FWPKGTMP="$( tmpdir "${DESTDIR}/var/db/pkg/.firmware" )"
1.138 afresh1 225: local _flags=-vm
226: case "$VERBOSE" in
227: 0|1) _flags=-VM ;;
228: 2|3) _flags=-Vm ;;
229: esac
230:
1.139 afresh1 231: ftp -N "${0##/}" -D "$_m" "$_flags" -o- "file:${1}" |
1.129 afresh1 232: tar -s ",^\+,${FWPKGTMP}/+," \
1.69 afresh1 233: -s ",^firmware,${DESTDIR}/etc/firmware," \
234: -C / -zxphf - "+*" "firmware/*"
1.1 afresh1 235:
1.129 afresh1 236: _pkgname="$( sed -n '/^@name /{s///p;q;}' "${FWPKGTMP}/+CONTENTS" )"
1.106 afresh1 237: if [ ! "$_pkgname" ]; then
238: echo "Failed to extract name from $1, partial install" 2>&1
1.129 afresh1 239: rm -rf "$FWPKGTMP"
240: unset FWPKGTMP
1.106 afresh1 241: return 1
242: fi
243:
1.50 afresh1 244: # TODO: Should we mark these so real fw_update can -Drepair?
1.129 afresh1 245: ed -s "${FWPKGTMP}/+CONTENTS" <<EOL
1.50 afresh1 246: /^@comment pkgpath/ -1a
247: @option manual-installation
248: @option firmware
249: @comment install-script
250: .
251: w
252: EOL
1.106 afresh1 253:
1.129 afresh1 254: chmod 755 "$FWPKGTMP"
255: mv "$FWPKGTMP" "${DESTDIR}/var/db/pkg/${_pkgname}"
256: unset FWPKGTMP
1.50 afresh1 257: }
1.22 afresh1 258:
1.50 afresh1 259: delete_firmware() {
1.51 afresh1 260: local _cwd _pkg="$1" _pkgdir="${DESTDIR}/var/db/pkg"
1.22 afresh1 261:
1.50 afresh1 262: # TODO: Check hash for files before deleting
1.140 afresh1 263: [ "$VERBOSE" -gt 2 ] && echo -n "Uninstall $_pkg ..."
1.51 afresh1 264: _cwd="${_pkgdir}/$_pkg"
1.50 afresh1 265:
1.107 afresh1 266: if [ ! -e "$_cwd/+CONTENTS" ] ||
267: ! grep -Fxq '@option firmware' "$_cwd/+CONTENTS"; then
268: echo "${0##*/}: $_pkg does not appear to be firmware" >&2
269: return 2
270: fi
271:
1.51 afresh1 272: set -A _remove -- "${_cwd}/+CONTENTS" "${_cwd}"
1.50 afresh1 273:
274: while read -r c g; do
275: case $c in
1.51 afresh1 276: @cwd) _cwd="${DESTDIR}$g"
1.50 afresh1 277: ;;
278: @*) continue
279: ;;
1.52 afresh1 280: *) set -A _remove -- "$_cwd/$c" "${_remove[@]}"
1.50 afresh1 281: ;;
282: esac
283: done < "${_pkgdir}/${_pkg}/+CONTENTS"
284:
285: # We specifically rm -f here because not removing files/dirs
286: # is probably not worth failing over.
287: for _r in "${_remove[@]}" ; do
288: if [ -d "$_r" ]; then
289: # Try hard not to actually remove recursively
290: # without rmdir on the install media.
1.95 afresh1 291: set +o noglob
1.50 afresh1 292: [ "$_r/*" = "$( echo "$_r"/* )" ] && rm -rf "$_r"
1.95 afresh1 293: set -o noglob
1.50 afresh1 294: else
295: rm -f "$_r"
1.22 afresh1 296: fi
297: done
1.138 afresh1 298:
1.140 afresh1 299: [ "$VERBOSE" -gt 2 ] && echo " done."
1.139 afresh1 300:
301: return 0
1.50 afresh1 302: }
1.1 afresh1 303:
1.59 afresh1 304: usage() {
1.147 afresh1 305: echo "usage: ${0##*/} [-d | -F] [-av] [-p path] [driver | file ...]"
1.59 afresh1 306: exit 2
307: }
308:
1.113 afresh1 309: ALL=false
1.142 afresh1 310: OPT_F=
311: while getopts :adFnp:v name
1.59 afresh1 312: do
1.145 afresh1 313: case "$name" in
314: a) ALL=true ;;
315: d) DELETE=true ;;
316: F) OPT_F=true ;;
317: n) DRYRUN=true ;;
318: p) LOCALSRC="$OPTARG" ;;
319: v) VERBOSE=$(( VERBOSE + 1 )) ;;
320: :)
321: echo "${0##*/}: option requires an argument -- -$OPTARG" >&2
322: usage 2
323: ;;
324: ?)
325: echo "${0##*/}: unknown option -- -$OPTARG" >&2
326: usage 2
327: ;;
328: esac
1.59 afresh1 329: done
330: shift $((OPTIND - 1))
331:
1.121 afresh1 332: if [ "$LOCALSRC" ]; then
333: if [[ $LOCALSRC = @(ftp|http?(s))://* ]]; then
334: FWURL="${LOCALSRC}"
335: LOCALSRC=
336: else
337: LOCALSRC="${LOCALSRC:#file:}"
338: ! [ -d "$LOCALSRC" ] &&
339: echo "The path must be a URL or an existing directory" >&2 &&
340: exit 2
341: fi
342: fi
343:
1.122 afresh1 344: # "Download only" means local dir and don't install
1.142 afresh1 345: if [ "$OPT_F" ]; then
1.87 afresh1 346: INSTALL=false
1.121 afresh1 347: LOCALSRC="${LOCALSRC:-.}"
1.144 afresh1 348:
349: # Always check for latest CFILE and so latest firmware
350: if [ -e "$LOCALSRC/$CFILE" ]; then
351: mv "$LOCALSRC/$CFILE" "$LOCALSRC/$CFILE-OLD"
352: if fetch_cfile; then
353: rm -f "$LOCALSRC/$CFILE-OLD"
354: else
355: mv "$LOCALSRC/$CFILE-OLD" "$LOCALSRC/$CFILE"
356: echo "Using existing $CFILE" >&2
357: fi
358: fi
1.130 afresh1 359: elif [ "$LOCALSRC" ]; then
360: DOWNLOAD=false
1.87 afresh1 361: fi
1.64 afresh1 362:
1.118 afresh1 363: if [ -x /usr/bin/id ] && [ "$(/usr/bin/id -u)" != 0 ]; then
364: echo "need root privileges" >&2
365: exit 1
1.94 afresh1 366: fi
367:
1.123 afresh1 368: set -sA devices -- "$@"
1.111 afresh1 369:
370: if "$DELETE"; then
1.142 afresh1 371: [ "$OPT_F" ] && usage 22
1.111 afresh1 372:
1.139 afresh1 373: # Show the "Uninstalling" message when just deleting not upgrading
1.141 afresh1 374: [ "$VERBOSE" -gt 0 ] && VERBOSE=3
1.139 afresh1 375:
1.113 afresh1 376: set -A installed
377: if [ "${devices[*]:-}" ]; then
378: "$ALL" && usage 22
379:
380: set -A installed -- $(
381: for d in "${devices[@]}"; do
382: f="${d##*/}" # only care about the name
383: f="${f%.tgz}" # allow specifying the package name
384: [ "$( firmware_devicename "$f" )" = "$f" ] && f="$f-firmware"
385:
386: set -A i -- $( installed_firmware '' "$f-" '*' )
387:
388: if [ "${i[*]:-}" ]; then
389: echo "${i[@]}"
390: else
391: echo "No firmware found for '$d'" >&2
392: fi
393: done
394: )
395: elif "$ALL"; then
396: set -A installed -- $( installed_firmware '*' '-firmware-' '*' )
397: fi
1.111 afresh1 398:
399: deleted=''
1.113 afresh1 400: if [ "${installed:-}" ]; then
1.111 afresh1 401: for fw in "${installed[@]}"; do
1.131 afresh1 402: if "$DRYRUN"; then
1.138 afresh1 403: [ "$VERBOSE" -gt 0 ] && echo "Delete $fw"
1.131 afresh1 404: else
405: delete_firmware "$fw" || continue
406: fi
1.112 afresh1 407: deleted="$deleted,$( firmware_devicename "$fw" )"
1.111 afresh1 408: done
1.113 afresh1 409: fi
1.111 afresh1 410:
1.139 afresh1 411: deleted="${deleted#,}"
1.111 afresh1 412: echo "${0:##*/}: deleted ${deleted:-none}";
413:
414: exit
415: fi
1.125 afresh1 416:
417: if [ ! "$LOCALSRC" ]; then
1.145 afresh1 418: LOCALSRC="$( tmpdir "${DESTDIR}/tmp/${0##*/}" )"
419: REMOVE_LOCALSRC=true
1.125 afresh1 420: fi
421:
1.144 afresh1 422: CFILE="$LOCALSRC/$CFILE"
423:
1.113 afresh1 424: if [ "${devices[*]:-}" ]; then
425: "$ALL" && usage 22
426: else
1.139 afresh1 427: [ "$VERBOSE" -gt 1 ] && echo -n "Detect firmware ..."
1.124 afresh1 428: set -sA devices -- $( detect_firmware )
1.139 afresh1 429: [ "$VERBOSE" -gt 1 ] &&
1.101 afresh1 430: { [ "${devices[*]:-}" ] && echo " found." || echo " done." ; }
1.50 afresh1 431: fi
1.91 afresh1 432:
433: [ "${devices[*]:-}" ] || exit
1.50 afresh1 434:
1.103 afresh1 435: added=''
436: updated=''
1.115 afresh1 437: kept=''
1.70 afresh1 438: for f in "${devices[@]}"; do
439: d="$( firmware_devicename "$f" )"
440:
1.148 ! afresh1 441: verify_existing=true
1.58 afresh1 442: if [ "$f" = "$d" ]; then
443: f=$( firmware_filename "$d" || true )
444: [ "$f" ] || continue
1.69 afresh1 445: f="$LOCALSRC/$f"
1.76 afresh1 446: elif ! "$INSTALL" && ! grep -Fq "($f)" "$CFILE" ; then
1.70 afresh1 447: echo "Cannot download local file $f" >&2
448: exit 2
1.146 afresh1 449: else
450: # If someone specified a filename on the command-line
451: # we don't want to verify it.
452: verify_existing=false
1.58 afresh1 453: fi
454:
1.110 afresh1 455: set -A installed -- $( installed_firmware '' "$d-firmware-" '*' )
1.50 afresh1 456:
1.68 afresh1 457: if "$INSTALL" && [ "${installed[*]:-}" ]; then
1.65 afresh1 458: for i in "${installed[@]}"; do
1.58 afresh1 459: if [ "${f##*/}" = "$i.tgz" ]; then
1.139 afresh1 460: [ "$VERBOSE" -gt 2 ] && echo "Keep $i"
1.115 afresh1 461: kept="$kept,$d"
1.11 afresh1 462: continue 2
1.1 afresh1 463: fi
464: done
1.50 afresh1 465: fi
1.1 afresh1 466:
1.148 ! afresh1 467: if "$verify_existing" && [ -e "$f" ]; then
! 468: msg="Keep/Verify"
! 469: "$INSTALL" && msg="Verify"
! 470: [ "$VERBOSE" -gt 1 ] && ! "$INSTALL" &&
! 471: echo "$msg ${f##*/}"
! 472:
! 473: if "$DRYRUN" || verify "$f"; then
1.131 afresh1 474: "$INSTALL" || kept="$kept,$d"
1.148 ! afresh1 475: elif "$DOWNLOAD"; then
! 476: [ "$VERBOSE" -gt 0 ] && echo "Refetching $f"
! 477: rm -f $f
! 478: else
! 479: continue
1.72 afresh1 480: fi
1.148 ! afresh1 481: fi
! 482:
! 483: if [ -e "$f" ]; then
! 484: true # verified above
1.75 afresh1 485: elif "$DOWNLOAD"; then
1.131 afresh1 486: if "$DRYRUN"; then
1.138 afresh1 487: [ "$VERBOSE" -gt 0 ] && echo "Get/Verify ${f##*/}"
1.131 afresh1 488: else
1.138 afresh1 489: [ "$VERBOSE" -eq 1 ] && echo -n "Get/Verify ${f##*/} ..."
490: fetch "$f" &&
491: verify "$f" ||
492: { [ "$VERBOSE" -eq 1 ] && echo " failed."; continue; }
1.139 afresh1 493: [ "$VERBOSE" -eq 1 ] && ! "$INSTALL" && echo " done."
1.131 afresh1 494: fi
1.138 afresh1 495: "$INSTALL" || added="$added,$d"
1.75 afresh1 496: elif "$INSTALL"; then
1.72 afresh1 497: echo "Cannot install ${f##*/}, not found" >&2
498: continue
1.58 afresh1 499: fi
1.60 afresh1 500:
1.68 afresh1 501: "$INSTALL" || continue
1.11 afresh1 502:
1.139 afresh1 503: update=''
1.65 afresh1 504: if [ "${installed[*]:-}" ]; then
1.50 afresh1 505: for i in "${installed[@]}"; do
1.131 afresh1 506: "$DRYRUN" || delete_firmware "$i"
1.139 afresh1 507: update="Update"
1.50 afresh1 508: done
509: fi
1.11 afresh1 510:
1.139 afresh1 511: "$DRYRUN" || add_firmware "$f" "$update"
1.103 afresh1 512:
1.131 afresh1 513: f="${f##*/}"
514: f="${f%.tgz}"
1.139 afresh1 515: if [ "$update" ]; then
1.140 afresh1 516: if [ "$VERBOSE" -eq 1 ] && "$DOWNLOAD" && ! "$DRYRUN"; then
517: echo " updated."
1.139 afresh1 518: elif [ "$VERBOSE" -eq 1 ]; then
1.140 afresh1 519: echo "Update $f"
520: elif [ "$VERBOSE" -gt 0 ] && "$DRYRUN"; then
521: echo "Update $f"
1.139 afresh1 522: fi
1.114 afresh1 523: updated="$updated,$d"
1.103 afresh1 524: else
1.140 afresh1 525: if [ "$VERBOSE" -eq 1 ] && "$DOWNLOAD" && ! "$DRYRUN"; then
526: echo " installed."
1.139 afresh1 527: elif [ "$VERBOSE" -eq 1 ]; then
1.140 afresh1 528: echo "Install $f"
529: elif [ "$VERBOSE" -gt 0 ] && "$DRYRUN"; then
530: echo "Install $f"
1.139 afresh1 531: fi
1.114 afresh1 532: added="$added,$d"
1.103 afresh1 533: fi
1.50 afresh1 534: done
1.1 afresh1 535:
1.114 afresh1 536: added="${added:#,}"
537: updated="${updated:#,}"
1.115 afresh1 538: kept="${kept:#,}"
1.117 afresh1 539: if "$INSTALL"; then
540: echo "${0##*/}: added ${added:-none}; updated ${updated:-none}; kept ${kept:-none}"
541: else
542: echo "${0##*/}: downloaded ${added:-none}; kept ${kept:-none}"
543: fi
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>