File microcode.init of Package microcode_ctl

#! /bin/sh
# Copyright (c) 2001-2002 SuSE Linux AG Nuernberg.  All rights reserved.
#
# Author: Björn Jacke <feedback@suse.de>
#
# /etc/init.d/microcode
#
# description: init script for Intel CPU microcode update
### BEGIN INIT INFO
# Provides:          microcode
# Required-Start:
# Required-Stop:
# Default-Start:     1 2 3 5 S
# Default-Stop:
# X-UnitedLinux-Default-Enabled: yes
# Short-Description: CPU microcode updater
# Description:       update the Intel CPU microcode (both 32 and 64 bit)
### END INIT INFO

. /etc/rc.status

rc_reset

do_start()
{
    echo -n "Checking/updating CPU microcode "
    if grep -q -i intel /proc/cpuinfo \
            && /sbin/modinfo microcode >& /dev/null; then
        /sbin/modprobe -q microcode
        /sbin/microcode_ctl -Qu
    else
        rc_failed 6
    fi
    rc_status -v
}

# See how we were called.
case "$1" in
    start)
        do_start
        ;;
    status)
        echo "$0: reading the microcode status is not yet suported"
        rc_failed 4
        rc_status -v
        ;;
    stop)
        ;;
    reload)
        do_start
        ;;
    *)
        echo "Usage: $0 start"
        exit 1
        ;;
esac
rc_exit


# vim: set sw=4 ts=4 et ft=sh: