void-packages/srcpkgs/microcode_ctl/files/microcode_ctl.rc

33 lines
557 B
Plaintext
Raw Normal View History

#!/sbin/runscript
: ${MICROCODE_DEVICE:=/dev/cpu/microcode}
: ${MICROCODE_FILE:=/lib/firmware/intel-microcode.dat}
depend()
{
need localmount
before *
}
start()
{
local modloaded
einfo "Applying Intel CPU microcode update"
if [ ! -c ${MICROCODE_DEVICE} ]; then
modprobe -q microcode
if [ $? -ne 0 ]; then
eerror "failed to load microcode module"
fi
fi
if [ ! -f ${MICROCODE_FILE} ]; then
eerror "cannot find microcode file"
fi
microcode_ctl -Q -f ${MICROCODE_FILE}
if [ $? -eq 0 ]; then
modprobe -q -r microcode
fi
eend $?
}