diff options
author | Alexander Hall <halex@cvs.openbsd.org> | 2011-07-09 17:56:47 +0000 |
---|---|---|
committer | Alexander Hall <halex@cvs.openbsd.org> | 2011-07-09 17:56:47 +0000 |
commit | 3da6eeecf5f5646afabc209c118bf439cfaf740c (patch) | |
tree | 42271888554cc6a46475dafd53adb6d3640edb4a /usr.sbin/fw_update | |
parent | 1ecde188491ece1f56ab767f32b727606e35f70f (diff) |
- use pkg_info -q instead of looking in /var/db/pkg/*. it is not as expensive
as I thought.
- pass -D repair to pkg_add
- move the 'updating firmwares' message into rc.firsttime
first two from espie@ and sthen@, respectively; thanks
"looks good" deraadt@
Diffstat (limited to 'usr.sbin/fw_update')
-rw-r--r-- | usr.sbin/fw_update/fw_update.sh | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/usr.sbin/fw_update/fw_update.sh b/usr.sbin/fw_update/fw_update.sh index 3f0195e3794..cbab9e638b0 100644 --- a/usr.sbin/fw_update/fw_update.sh +++ b/usr.sbin/fw_update/fw_update.sh @@ -14,6 +14,12 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# This is the list of drivers we should look for +DRIVERS="acx athn bwi ipw iwi iwn malo otus pgt rsu uath ueagle upgt urtwn + uvideo wpi" + +PKG_ADD="pkg_add -D repair" + [ 0 = $(id -u) ] || { echo "${0##*/} must be run as root" >&2; exit 1; } usage() { @@ -38,16 +44,15 @@ version=$1 tag=$2 [ -n "$tag" -a X"$tag" != X"-stable" ] && version=snapshots - export PKG_PATH=http://firmware.openbsd.org/firmware/$version/ -DRIVERS="acx athn bwi ipw iwi iwn malo otus pgt rsu uath ueagle upgt urtwn uvideo wpi" +installed=$(pkg_info -q) install= update= for driver in $DRIVERS; do - if test -d /var/db/pkg/${driver}-firmware-*; then + if print -r -- "$installed" | grep -q "^${driver}-firmware-*"; then update="$update ${driver}-firmware" elif grep -q "^${driver}[0-9][0-9]* at " /var/run/dmesg.boot; then install="$install ${driver}-firmware" @@ -56,10 +61,8 @@ done [ "$install$update" ] || exit 0 -echo 'updating firmwares' - # Install missing firmwares -[ "$install" ] && pkg_add $verbose $install +[ "$install" ] && $PKG_ADD $verbose $install # Update installed firmwares -[ "$update" ] && pkg_add $verbose -u $update +[ "$update" ] && $PKG_ADD $verbose -u $update |