#!/bin/sh
#=================================================================
# Begin cpufre
#
# Description : Procedure to handle CPU microcode update
#
#=================================================================

### BEGIN INIT INFO
# Provides:            $microcode
# Should-Start:        
# Required-Stop:       
# Should-Stop:         
# Default-Start:       3 4 5
# Default-Stop:        0 1 2 6
# Short-Description:   Starts microcode update
# Description:         update CPUI microcode
### END INIT INFO

. /lib/lsb/init-functions

MICROF=/sys/devices/system/cpu/microcode/reload

if [ -f  ${MICROF} ] ; then
  case "$1" in
    start)
      log_info_msg "Updating CPU microcode..."
      echo 1 > ${MICROF}
      evaluate_retval
      ;;

   stop)
      echo 0 > ${MICROF}
      ;;

   restart)
      $0 start
      ;;

   *)
      echo "Usage: $0 {start|restart}"
      exit 1
      ;;
  esac
fi

# End /etc/init.d/cpufreq
