summaryrefslogtreecommitdiff
path: root/templates/system/options/ctrl-alt-del-action/node.def
blob: 3bbf2a811cc8d118240684824aefa0b18fbd9caf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
type: txt

help: Ctrl-Alt-Delete action

default: "ignore"

val_help: ignore; Ignore Ctrl-Alt-Delete
val_help: reboot; Reboot VyOS
val_help: poweroff; Poweroff VyOS

syntax:expression: $VAR(@) in "ignore", "reboot", "poweroff"; "Value must be ignore, reboot, or poweroff"

end:
  if [ $VAR(@) == "ignore" ]; 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