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.
/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 00:14: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,23 +30,29 @@ verbose() {
[ "$verbose" ] && echo "${0##*/}: $@"
}
+setver() {
+ version=$1
+ tag=$2
+}
+
+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
+shift $((OPTIND - 1))
-set -- $(sysctl -n kern.version | sed 's/^OpenBSD \([0-9]\.[0-9]\)\([^
]*\).*/\1 \2/;q')
+$all && set -- $DRIVERS
-version=$1
-tag=$2
+setver $(sysctl -n kern.version |
+ sed 's/^OpenBSD \([0-9]\.[0-9]\)\([^ ]*\).*/\1 \2/;q')
[[ $tag == -!(stable) ]] && version=snapshots
export PKG_PATH=http://firmware.openbsd.org/firmware/$version/
@@ -59,10 +65,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