10.0
10.0-rc1
10.1
10.1-rc1
11.0
11.0-rc1
11.0-rc2
11.0-rc3
11.1
11.1-rc1
11.2
11.2-rc1
11.3
11.3-rc1
12.0
12.0-rc1
12.1
12.1-rc1
7.0
7.1
7.2
7.3
7.4
7.5
7.5-systemd
7.6
7.6-systemd
7.7
7.7-systemd
7.8
7.8-systemd
7.9
7.9-systemd
8.0
8.1
8.2
8.3
8.4
9.0
9.1
arm
bdubbs/gcc13
ml-11.0
multilib
renodr/libudev-from-systemd
s6-init
trunk
xry111/arm64
xry111/arm64-12.0
xry111/clfs-ng
xry111/lfs-next
xry111/loongarch
xry111/loongarch-12.0
xry111/loongarch-12.1
xry111/mips64el
xry111/pip3
xry111/rust-wip-20221008
xry111/update-glibc
Line | |
---|
1 | #!/bin/sh
|
---|
2 | ########################################################################
|
---|
3 | # Begin consolelog
|
---|
4 | #
|
---|
5 | # Description : Set the kernel log level for the console
|
---|
6 | #
|
---|
7 | # Authors : Dan Nicholson - dnicholson@linuxfromscratch.org
|
---|
8 | # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
|
---|
9 | # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
|
---|
10 | #
|
---|
11 | # Version : LFS 7.0
|
---|
12 | #
|
---|
13 | # Notes : /proc must be mounted before this can run
|
---|
14 | #
|
---|
15 | ########################################################################
|
---|
16 |
|
---|
17 | ### BEGIN INIT INFO
|
---|
18 | # Provides: consolelog
|
---|
19 | # Required-Start:
|
---|
20 | # Should-Start:
|
---|
21 | # Required-Stop:
|
---|
22 | # Should-Stop:
|
---|
23 | # Default-Start: S
|
---|
24 | # Default-Stop:
|
---|
25 | # Short-Description: Sets the console log level.
|
---|
26 | # Description: Sets the console log level.
|
---|
27 | # X-LFS-Provided-By: LFS
|
---|
28 | ### END INIT INFO
|
---|
29 |
|
---|
30 | . /lib/boot/functions
|
---|
31 |
|
---|
32 | # set the default loglevel
|
---|
33 | LOGLEVEL=7
|
---|
34 |
|
---|
35 | [ -r /etc/sysconfig/console ] && . /etc/sysconfig/console
|
---|
36 |
|
---|
37 | case "${1}" in
|
---|
38 | start)
|
---|
39 | case "$LOGLEVEL" in
|
---|
40 | [1-8])
|
---|
41 | boot_mesg "Setting the console log level to ${LOGLEVEL}..."
|
---|
42 | dmesg -n $LOGLEVEL
|
---|
43 | evaluate_retval
|
---|
44 | ;;
|
---|
45 | *)
|
---|
46 | boot_mesg "Console log level '${LOGLEVEL}' is invalid" ${FAILURE}
|
---|
47 | echo_failure
|
---|
48 | ;;
|
---|
49 | esac
|
---|
50 | ;;
|
---|
51 |
|
---|
52 | status)
|
---|
53 | # Read the current value if possible
|
---|
54 | if [ -r /proc/sys/kernel/printk ]; then
|
---|
55 | read level line < /proc/sys/kernel/printk
|
---|
56 | else
|
---|
57 | boot_mesg "Can't read the current console log level" ${FAILURE}
|
---|
58 | echo_failure
|
---|
59 | fi
|
---|
60 |
|
---|
61 | # Print the value
|
---|
62 | if [ -n "$level" ]; then
|
---|
63 | ${ECHO} -e "${INFO}The current console log level is ${level}${NORMAL}"
|
---|
64 | fi
|
---|
65 | ;;
|
---|
66 |
|
---|
67 | *)
|
---|
68 | echo "Usage: ${0} {start|status}"
|
---|
69 | exit 1
|
---|
70 | ;;
|
---|
71 | esac
|
---|
72 |
|
---|
73 | # End consolelog
|
---|
Note:
See
TracBrowser
for help on using the repository browser.