version 1.31, 2021/11/18 02:18:32 |
version 1.37, 2021/12/01 02:04:18 |
|
|
#!/bin/ksh |
#!/bin/ksh |
|
# $OpenBSD$ |
set -e |
set -e |
|
|
# 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 |
|
|
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 |
|
|
|
|
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 |
FWPATTERNS="file:${0%/*}/firmware_patterns" |
FWPATTERNS="${DESTDIR}/usr/share/misc/firmware_patterns" |
|
|
# TODO: support srclocal installation of firmware somehow |
# TODO: support srclocal installation of firmware somehow |
fw_update() { |
fw_install() { |
local _src=$1 _tmpfs_list _tmpfs _tmpsrc \ |
local _src=$1 _tmpfs_list _tmpfs _tmpsrc \ |
_t=Get _cfile="/tmp/SHA256" _pkgdir=${DESTDIR}/var/db/pkg \ |
_t=Get _cfile="/tmp/SHA256" _pkgdir=${DESTDIR}/var/db/pkg \ |
_f _r _remove _i _installed |
_f _r _remove _i _installed |
|
|
echo "Let's $MODE firmware!" |
echo "Let's $MODE firmware!" |
local _d _drivers=$( |
local _d _drivers=$( |
last='' |
last='' |
$_unpriv ftp -D "Detecting" -Vmo- $FWPATTERNS | |
|
while read _d _m; do |
while read _d _m; do |
grep=grep |
grep=grep |
[ "$last" = "$_d" ] && continue |
[ "$last" = "$_d" ] && continue |
|
|
$grep -q "$_m" /var/run/dmesg.boot || continue |
$grep -q "$_m" /var/run/dmesg.boot || continue |
echo $_d |
echo $_d |
last=$_d |
last=$_d |
done |
done < $FWPATTERNS |
) |
) |
|
|
if [ -z "$_drivers" ]; then |
if [ -z "$_drivers" ]; then |
|
|
done |
done |
} |
} |
|
|
fw_update "$FWURL" |
fw_install "$FWURL" |