summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2014-04-10 06:43:51 -0700
committerDaniil Baturin <daniil@baturin.org>2014-04-10 06:43:51 -0700
commit2f1bab97eb9d0d205e71fcca7b3a55893aed6c65 (patch)
treeb488b45b3f620c6ed1ae46d132625f8f06324500
parent9e923beec8e06b728704064336c0097451faff2b (diff)
parent2edb636e0bbdcba17edb1e88db568fc7508eedf5 (diff)
downloadvyatta-cfg-system-2f1bab97eb9d0d205e71fcca7b3a55893aed6c65.tar.gz
vyatta-cfg-system-2f1bab97eb9d0d205e71fcca7b3a55893aed6c65.zip
Merge pull request #9 from hydrajump/ctrl-alt-del-action
Bug #173: Add system option for ctrl-alt-del-action to configuration
-rw-r--r--templates/system/options/ctrl-alt-del-action/node.def26
1 files changed, 26 insertions, 0 deletions
diff --git a/templates/system/options/ctrl-alt-del-action/node.def b/templates/system/options/ctrl-alt-del-action/node.def
new file mode 100644
index 00000000..8a5ed9d5
--- /dev/null
+++ b/templates/system/options/ctrl-alt-del-action/node.def
@@ -0,0 +1,26 @@
+type: txt
+
+help: Ctrl-Alt-Delete action
+
+default: "disable"
+
+val_help: disable; Disable Ctrl-Alt-Delete
+val_help: reboot; Reboot VyOS
+val_help: poweroff; Poweroff VyOS
+
+syntax:expression: $VAR(@) in "disable", "reboot", "poweroff"; "Value must be disable, reboot, or poweroff"
+
+end:
+ if [ $VAR(@) == "disable" ]; then
+ sudo sh -c "sed -i -e 's/^ca.*/ca:12345:ctrlaltdel:/' \
+ /etc/inittab"
+ elif [ $VAR(@) == "reboot" ]; then
+ sudo sh -c "sed -i -e 's/^ca.*/ca:12345:ctrlaltdel:\/sbin\/reboot/' \
+ /etc/inittab"
+ elif [ $VAR(@) == "poweroff" ]; then
+ sudo sh -c "sed -i -e 's/^ca.*/ca:12345:ctrlaltdel:\/sbin\/shutdown -h now/' \
+ /etc/inittab"
+ fi
+
+ # Reload /etc/inittab for change to take effect
+ sudo /sbin/init q