| version 1.29, 2021/11/18 01:44:30 | 
version 1.33, 2021/11/19 03:13:11 | 
 | 
 | 
|  #!/bin/ksh | 
 #!/bin/ksh | 
|  set -e | 
 set -e | 
|   | 
  | 
|  scan_dmesg() { | 
  | 
|          # no bsort for now | 
  | 
|          sed -n "$1" /var/run/dmesg.boot | 
  | 
|  } | 
  | 
|   | 
  | 
|  # Fake up some things from install.sub that we don't need to actually do | 
 # Fake up some things from install.sub that we don't need to actually do | 
|  prefetcharea_fs_list() { | 
 prefetcharea_fs_list() { | 
|          echo "${DESTDIR}/tmp" | 
         echo "${DESTDIR}/tmp" | 
|  } | 
 } | 
|  reset_watchdog() { | 
  | 
|  } | 
  | 
|   | 
  | 
|  # tmpdir, do_as, unpriv, and unpriv2 are from install.sub | 
 # tmpdir, do_as, unpriv, and unpriv2 are from install.sub | 
|   | 
  | 
 | 
 | 
|          do_as _file "$@" | 
         do_as _file "$@" | 
|  } | 
 } | 
|   | 
  | 
|  # "fail" needs to be replaced with the "ask_yn" loop like in the installer. | 
 VNAME=${VNAME:-$(sysctl -n kern.osrelease)} | 
|  _issue= | 
 VERSION=${VERSION:"${VNAME%.*}${VNAME#*.}"} | 
|  fail() { | 
 FWDIR=${FWDIR:-$VNAME} | 
|          echo $_issue >&2 | 
  | 
|          exit 1 | 
  | 
|  } | 
  | 
|   | 
  | 
|  VNAME=$(sysctl -n kern.osrelease) | 
  | 
|  VERSION="${VNAME%.*}${VNAME#*.}" | 
  | 
|  FWDIR="$VNAME" | 
  | 
|  MODE=${MODE:-install} | 
 MODE=${MODE:-install} | 
|   | 
  | 
|  # TODO: We need the firmware for the system we just installed | 
 # TODO: We need the firmware for the system we just installed | 
 | 
 | 
|  #       Otherwise, the fw_update after first boot will fix it up for us. | 
 #       Otherwise, the fw_update after first boot will fix it up for us. | 
|   | 
  | 
|  HTTP_FWDIR=$FWDIR | 
 HTTP_FWDIR=$FWDIR | 
|  set -- $(scan_dmesg "/^OpenBSD $VNAME\([^ ]*\).*$/s//\1/p") | 
 set -- sed -n "/^OpenBSD $VNAME\([^ ]*\).*$/s//\1/p" /var/run/dmesg.boot | 
|  [[ $1 == -!(stable) ]] && HTTP_FWDIR=snapshots | 
 [[ $1 == -!(stable) ]] && HTTP_FWDIR=snapshots | 
|   | 
  | 
|  FWURL=http://firmware.openbsd.org/firmware/${HTTP_FWDIR} | 
 FWURL=http://firmware.openbsd.org/firmware/${HTTP_FWDIR} | 
 | 
 | 
|              echo "Signature check of SHA256.sig failed" >&2 && return 1 | 
             echo "Signature check of SHA256.sig failed" >&2 && return 1 | 
|   | 
  | 
|          for _d in $_drivers; do | 
         for _d in $_drivers; do | 
|                  $UU && reset_watchdog | 
  | 
|                  _f=$( sed -n "s/.*(\($_d-firmware-.*\.tgz\)).*/\1/p" "$_cfile" ) | 
                 _f=$( sed -n "s/.*(\($_d-firmware-.*\.tgz\)).*/\1/p" "$_cfile" ) | 
|                  _installed=$( | 
                 _installed=$( | 
|                  for fw in "${_pkgdir}/$_d-firmware"*; do | 
                 for fw in "${_pkgdir}/$_d-firmware"*; do |