summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorhydrajump <wave@hydrajump.com>2014-04-09 23:26:55 +0200
committerhydrajump <wave@hydrajump.com>2014-04-09 23:26:55 +0200
commit332f9266b2b09e7afec24a31075f8552a6765564 (patch)
treec8ebcb525324891b9265e9e6771a72135ca98867 /templates
parent9e923beec8e06b728704064336c0097451faff2b (diff)
downloadvyatta-cfg-system-332f9266b2b09e7afec24a31075f8552a6765564.tar.gz
vyatta-cfg-system-332f9266b2b09e7afec24a31075f8552a6765564.zip
Add system option for ctrl-alt-del-action to configuration
This new configuration option allows the user to specify what action to take on ctrl-alt-delete: disable, reboot or poweroff. By default ctrl-alt-delete-action is set to disable. The ctrl-alt-delete action is configured in /etc/inittab.
Diffstat (limited to 'templates')
-rw-r--r--templates/system/options/ctrl-alt-del-action/node.def28
1 files changed, 28 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..d13fe3c5
--- /dev/null
+++ b/templates/system/options/ctrl-alt-del-action/node.def
@@ -0,0 +1,28 @@
+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
+
+end:
+ if [ $VAR(@) == "disable" ]; then
+ sudo sh -c "sed -i -e 's/^ca.*/ca:12345:ctrlaltdel:/' \
+ /etc/inittab"
+ fi
+
+ if [ $VAR(@) == "reboot" ]; then
+ sudo sh -c "sed -i -e 's/^ca.*/ca:12345:ctrlaltdel:\/sbin\/reboot/' \
+ /etc/inittab"
+ fi
+
+ if [ $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