[BACK]Return to fw_install.sh CVS log [TXT][DIR] Up to [local] / openbsd / fw_update

Diff for /openbsd/fw_update/fw_install.sh between version 1.142 and 1.145

version 1.142, 2022/01/07 00:38:06 version 1.145, 2022/01/07 02:18:52
Line 122 
Line 122 
         fi          fi
 }  }
   
   fetch_cfile() {
           if "$DOWNLOAD"; then
                   set +o noclobber # we want to get the latest CFILE
                   fetch "$CFILE" || return 1
                   set -o noclobber
                   ! signify -qVep "$FWPUB_KEY" -x "$CFILE" -m "$CFILE" &&
                       echo "Signature check of SHA256.sig failed" >&2 && return 1
           elif [ ! -e "$CFILE" ]; then
                   echo "${0##*/}: $CFILE: No such file or directory" >&2
                   return 2
           fi
   }
   
 verify() {  verify() {
           [ -e "$CFILE" ] || fetch_cfile
         # On the installer we don't get sha256 -C, so fake it.          # On the installer we don't get sha256 -C, so fake it.
         if ! fgrep -qx "SHA256 (${1##*/}) = $( /bin/sha256 -qb "$1" )" "$CFILE"; then          if ! fgrep -qx "SHA256 (${1##*/}) = $( /bin/sha256 -qb "$1" )" "$CFILE"; then
                 echo "Checksum test for ${1##*/} failed." >&2                  echo "Checksum test for ${1##*/} failed." >&2
Line 152 
Line 166 
   
 firmware_filename() {  firmware_filename() {
         local _f          local _f
           [ -e "$CFILE" ] || fetch_cfile
         _f="$( sed -n "s/.*(\($1-firmware-.*\.tgz\)).*/\1/p" "$CFILE" | sed '$!d' )"          _f="$( sed -n "s/.*(\($1-firmware-.*\.tgz\)).*/\1/p" "$CFILE" | sed '$!d' )"
         ! [ "$_f" ] && echo "Unable to find firmware for $1" >&2 && return 1          ! [ "$_f" ] && echo "Unable to find firmware for $1" >&2 && return 1
         echo "$_f"          echo "$_f"
Line 289 
Line 304 
 OPT_F=  OPT_F=
 while getopts :adFnp:v name  while getopts :adFnp:v name
 do  do
        case "$name" in          case "$name" in
        a) ALL=true ;;          a) ALL=true ;;
        d) DELETE=true ;;          d) DELETE=true ;;
        F) OPT_F=true ;;          F) OPT_F=true ;;
        n) DRYRUN=true ;;          n) DRYRUN=true ;;
        p) LOCALSRC="$OPTARG" ;;          p) LOCALSRC="$OPTARG" ;;
        v) VERBOSE=$(( VERBOSE + 1 )) ;;          v) VERBOSE=$(( VERBOSE + 1 )) ;;
        :)          :)
            echo "${0##*/}: option requires an argument -- -$OPTARG" >&2              echo "${0##*/}: option requires an argument -- -$OPTARG" >&2
            usage 2              usage 2
            ;;              ;;
        ?)          ?)
            echo "${0##*/}: unknown option -- -$OPTARG" >&2              echo "${0##*/}: unknown option -- -$OPTARG" >&2
            usage 2              usage 2
            ;;              ;;
        esac          esac
 done  done
 shift $((OPTIND - 1))  shift $((OPTIND - 1))
   
Line 324 
Line 339 
 if [ "$OPT_F" ]; then  if [ "$OPT_F" ]; then
         INSTALL=false          INSTALL=false
         LOCALSRC="${LOCALSRC:-.}"          LOCALSRC="${LOCALSRC:-.}"
   
           # Always check for latest CFILE and so latest firmware
           if [ -e "$LOCALSRC/$CFILE" ]; then
                   mv "$LOCALSRC/$CFILE" "$LOCALSRC/$CFILE-OLD"
                   if fetch_cfile; then
                           rm -f "$LOCALSRC/$CFILE-OLD"
                   else
                           mv "$LOCALSRC/$CFILE-OLD" "$LOCALSRC/$CFILE"
                           echo "Using existing $CFILE" >&2
                   fi
           fi
 elif [ "$LOCALSRC" ]; then  elif [ "$LOCALSRC" ]; then
         DOWNLOAD=false          DOWNLOAD=false
 fi  fi
Line 383 
Line 409 
 fi  fi
   
 if [ ! "$LOCALSRC" ]; then  if [ ! "$LOCALSRC" ]; then
     LOCALSRC="$( tmpdir "${DESTDIR}/tmp/${0##*/}" )"          LOCALSRC="$( tmpdir "${DESTDIR}/tmp/${0##*/}" )"
     REMOVE_LOCALSRC=true          REMOVE_LOCALSRC=true
 fi  fi
   
 CFILE="$LOCALSRC/$CFILE"  CFILE="$LOCALSRC/$CFILE"
Line 399 
Line 425 
 fi  fi
   
 [ "${devices[*]:-}" ] || exit  [ "${devices[*]:-}" ] || exit
   
 if "$DOWNLOAD"; then  
         set +o noclobber # we want to get the latest CFILE  
         fetch "$CFILE"  
         set -o noclobber  
         ! signify -qVep "$FWPUB_KEY" -x "$CFILE" -m "$CFILE" &&  
             echo "Signature check of SHA256.sig failed" >&2 && exit 1  
 elif [ ! -e "$CFILE" ]; then  
         # TODO: We shouldn't need a CFILE if all arguments are files.  
         echo "${0##*/}: $CFILE: No such file or directory" >&2  
         exit 2  
 fi  
   
 added=''  added=''
 updated=''  updated=''

Legend:
Removed from v.1.142  
changed lines
  Added in v.1.145

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>