#!/bin/sh
echo ""
echo "hpbootorder version 1.00"
echo "HP BIOS Configuration Driver for Linux, Version 1.00"
echo "Copyright (c) 2004 Hewlett-Packard Development Company, L.P."
echo ""

if [ "$1" = "" ] || [ "$1" = "-help" ] || [ "$1" = "-h" ]
then
  echo "usage:"
  echo " hpbootorder { xyz | -p }"
  echo "   -p = print current order"
  echo "   where xyz is the desired boot order"
  echo "       x=first"
  echo "       y=second"
  echo "       z=third"
  echo ""
  echo "   values being"
  echo "       u for USB"
  echo "       h for Flash"
  echo "       n for Network"
  echo ""
  echo " for example"
  echo "   ./hpbootorder uhn"
  echo " would result in the boot order being 1-USB,2-Flash,3-Network"
  echo ""
  echo ""
else
  if [ "$1" = "-p" ] || [ "$1" = "-P" ]
  then
    insmod hpBIOScfg.o fn=1
    rmmod hpBIOScfg
    tail -n 15 /var/log/messages
  else
    insmod hpBIOScfg.o fn=1 order=$1
    rmmod hpBIOScfg
    tail -n 20 /var/log/messages
  fi
fi
