On 08/13/13 08:52, David Coppa wrote: > On Tue, Aug 13, 2013 at 2:23 AM, Alexander Hall <alexan...@beard.se> > wrote: >> On 08/12/13 18:49, Peter Hessler wrote: >>> this isn't a lesser operating system. all such drivers are >>> included out of the box. >>> >>> the only thing that may be missing, is the various firmware >>> files. Check out how fw_update(8) works to fetch those. >> >> This diff lets you pinpoint specific drivers, or use '-a' to >> install/update them all. I've been wanting to cook something like >> this up for a long time. Man page bits still missing. > > Nice! I like it. >
Ah, and then I even sent an old version. No functional difference IIRC, but anyway, here's what I intended to send. /Alexander Index: fw_update.sh =================================================================== RCS file: /cvs/src/usr.sbin/fw_update/fw_update.sh,v retrieving revision 1.12 diff -u -p -r1.12 fw_update.sh --- fw_update.sh 17 Sep 2012 18:28:43 -0000 1.12 +++ fw_update.sh 13 Aug 2013 07:09:50 -0000 @@ -22,7 +22,7 @@ DRIVERS="acx athn bwi ipw iwi iwn malo o PKG_ADD="pkg_add -I -D repair" usage() { - echo "usage: ${0##*/} [-nv]" >&2 + echo "usage: ${0##*/} [-anv] [driver ...]" >&2 exit 1 } @@ -30,26 +30,33 @@ verbose() { [ "$verbose" ] && echo "${0##*/}: $@" } +setpath() { + set -- $(sysctl -n kern.version | + sed 's/^OpenBSD \([0-9]\.[0-9]\)\([^ ]*\).*/\1 \2/;q') + + local version=$1 tag=$2 + + [[ $tag == -!(stable) ]] && version=snapshots + export PKG_PATH=http://firmware.openbsd.org/firmware/$version/ +} + +all=false verbose= nop= -while getopts 'nv' s "$@" 2>/dev/null; do +while getopts 'anv' s "$@" 2>/dev/null; do case "$s" in + a) all=true;; v) verbose=${verbose:--}v ;; n) nop=-n ;; *) usage ;; esac done -# No additional arguments allowed -[ $# = $(($OPTIND-1)) ] || usage - -set -- $(sysctl -n kern.version | sed 's/^OpenBSD \([0-9]\.[0-9]\)\([^ ]*\).*/\1 \2/;q') +shift $((OPTIND - 1)) -version=$1 -tag=$2 +$all && set -- $DRIVERS -[[ $tag == -!(stable) ]] && version=snapshots -export PKG_PATH=http://firmware.openbsd.org/firmware/$version/ +setpath installed=$(pkg_info -q) dmesg=$(cat /var/run/dmesg.boot; echo; dmesg) @@ -59,10 +66,12 @@ update= extra= for driver in $DRIVERS; do + [ $# = 0 ] || printf "%s\n" "$@" | fgrep -qx "$driver" || continue if print -r -- "$installed" | grep -q "^${driver}-firmware-"; then update="$update ${driver}-firmware" extra="$extra -Dupdate_${driver}-firmware" - elif print -r -- "$dmesg" | grep -q "^${driver}[0-9][0-9]* at "; then + elif [ $# != 0 ] || + print -r -- "$dmesg" | grep -q "^${driver}[0-9][0-9]* at "; then install="$install ${driver}-firmware" fi done