Browse Source

Turn off magic sysrq

Bob Mottram 7 years ago
parent
commit
364b57a3d9
1 changed files with 15 additions and 0 deletions
  1. 15
    0
      src/freedombone-utils-setup

+ 15
- 0
src/freedombone-utils-setup View File

@@ -286,6 +286,18 @@ function initial_setup {
286 286
     mark_completed $FUNCNAME
287 287
 }
288 288
 
289
+function turn_off_magic_sysrq {
290
+    if grep -q 'kernel.sysrq = 0' /etc/sysctl.conf; then
291
+        return
292
+    fi
293
+    if grep -q 'kernel.sysrq' /etc/sysctl.conf; then
294
+        sed -i 's|#kernel.sysrq.*|kernel.sysrq = 0|g' /etc/sysctl.conf
295
+        sed -i 's|kernel.sysrq.*|kernel.sysrq = 0|g' /etc/sysctl.conf
296
+    else
297
+        echo 'kernel.sysrq = 0' >> /etc/sysctl.conf
298
+    fi
299
+}
300
+
289 301
 function setup_grub {
290 302
     if [[ $ARCHITECTURE == 'qemu'* || $ARCHITECTURE == 'amd64' || $ARCHITECTURE == 'x86_64' || $ARCHITECTURE == 'i686' || $ARCHITECTURE == 'i386' ]]; then
291 303
         if ! grep -q 'ifnames=0' /etc/default/grub; then
@@ -782,6 +794,9 @@ function setup_utils {
782 794
     function_check enable_predictable_device_names
783 795
     enable_predictable_device_names
784 796
 
797
+    function_check turn_off_magic_sysrq
798
+    turn_off_magic_sysrq
799
+
785 800
     function_check separate_tmp_filesystem
786 801
     separate_tmp_filesystem 150
787 802