lfs/bootscripts/lfs/init.d/consolelog
Bruce Dubbs 1c4800743d Moved bootscripts and udev-config to BOOK
Updated Makefile to automatically generate bootscript and udev-config tarballs
Updated licesnse to be the same as BLFS

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@8548 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
2008-06-03 21:51:14 +00:00

62 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
# Begin $rc_base/init.d/consolelog
########################################################################
#
# Description : Set the kernel log level for the console
#
# Authors : Dan Nicholson - dnicholson@linuxfromscratch.org
#
# Version : 00.00
#
# Notes : /proc must be mounted before this can run
#
########################################################################
. /etc/sysconfig/rc
. ${rc_functions}
# set the default loglevel
LOGLEVEL=7
if [ -r /etc/sysconfig/console ]; then
. /etc/sysconfig/console
fi
case "${1}" in
start)
case "$LOGLEVEL" in
[1-8])
boot_mesg "Setting the console log level to ${LOGLEVEL}..."
dmesg -n $LOGLEVEL
evaluate_retval
;;
*)
boot_mesg "Console log level '${LOGLEVEL}' is invalid" ${FAILURE}
echo_failure
;;
esac
;;
status)
# Read the current value if possible
if [ -r /proc/sys/kernel/printk ]; then
read level line < /proc/sys/kernel/printk
else
boot_mesg "Can't read the current console log level" ${FAILURE}
echo_failure
fi
# Print the value
if [ -n "$level" ]; then
${ECHO} -e "${INFO}The current console log level" \
"is ${level}${NORMAL}"
fi
;;
*)
echo "Usage: ${0} {start|status}"
exit 1
;;
esac
# End $rc_base/init.d/consolelog