Turn off magic sysrq

This commit is contained in:
Bob Mottram 2017-08-09 17:46:09 +01:00
parent 850d5628a8
commit 364b57a3d9
1 changed files with 15 additions and 0 deletions

View File

@ -286,6 +286,18 @@ function initial_setup {
mark_completed $FUNCNAME mark_completed $FUNCNAME
} }
function turn_off_magic_sysrq {
if grep -q 'kernel.sysrq = 0' /etc/sysctl.conf; then
return
fi
if grep -q 'kernel.sysrq' /etc/sysctl.conf; then
sed -i 's|#kernel.sysrq.*|kernel.sysrq = 0|g' /etc/sysctl.conf
sed -i 's|kernel.sysrq.*|kernel.sysrq = 0|g' /etc/sysctl.conf
else
echo 'kernel.sysrq = 0' >> /etc/sysctl.conf
fi
}
function setup_grub { function setup_grub {
if [[ $ARCHITECTURE == 'qemu'* || $ARCHITECTURE == 'amd64' || $ARCHITECTURE == 'x86_64' || $ARCHITECTURE == 'i686' || $ARCHITECTURE == 'i386' ]]; then if [[ $ARCHITECTURE == 'qemu'* || $ARCHITECTURE == 'amd64' || $ARCHITECTURE == 'x86_64' || $ARCHITECTURE == 'i686' || $ARCHITECTURE == 'i386' ]]; then
if ! grep -q 'ifnames=0' /etc/default/grub; then if ! grep -q 'ifnames=0' /etc/default/grub; then
@ -782,6 +794,9 @@ function setup_utils {
function_check enable_predictable_device_names function_check enable_predictable_device_names
enable_predictable_device_names enable_predictable_device_names
function_check turn_off_magic_sysrq
turn_off_magic_sysrq
function_check separate_tmp_filesystem function_check separate_tmp_filesystem
separate_tmp_filesystem 150 separate_tmp_filesystem 150