Permalink
Browse files

Do not log kernel messages to TTY

  • Loading branch information...
NEMS Linux
NEMS Linux committed Feb 9, 2019
1 parent 2fe266b commit 04e03fdeef12a486eb172c1260e172cf5c70a5c4
Showing with 31 additions and 1 deletion.
  1. +1 −1 build/011-tty
  2. +30 −0 build/012-tty
@@ -14,7 +14,7 @@ fi

if ! grep -q "NEMS00000" /etc/rc.local; then

addition="# NEMS00000 Don't blank TTY1\nsetterm -blank 0\n\n"
addition="# NEMS00000 Do not blank TTY\nsetterm -blank 0\n\n"

if grep -q "exit" /etc/rc.local; then
# This file contains an exit command, so make sure our new command comes before it
@@ -0,0 +1,30 @@
#!/bin/bash

# Don't output kernel messages (such as firewall blocks) to TTY

if [[ ! -f /etc/rc.local ]]; then
echo "#!/bin/sh -e
" > /etc/rc.local
chmod +x /etc/rc.local
fi

if grep -q '"exit 0"' /etc/rc.local; then
sed -i~ '/"exit 0"/d' /etc/rc.local
fi

if ! grep -q "NEMS00002" /etc/rc.local; then

addition="# NEMS00002 Do not output kernel log to TTY\n/bin/dmesg -n 1\n\n"

if grep -q "exit" /etc/rc.local; then
# This file contains an exit command, so make sure our new command comes before it
/bin/sed -i -- 's,exit,'"$addition"'exit,g' /etc/rc.local
else
# No exit command within the file, so just add it
echo "PLACEHERE" >> /etc/rc.local
/bin/sed -i -- 's,PLACEHERE,'"$addition"'exit 0,g' /etc/rc.local
fi
/bin/systemctl stop rc-local.service
/bin/systemctl start rc-local.service
fi

0 comments on commit 04e03fd

Please sign in to comment.