Skip to contentSkip to conversation

sysvinit: Add ability to add default line for ctrl-alt-del

PATCH New Paul Gortmaker 1 participant 1 message Jun 6, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sysvinit: Add ability to add default line for ctrl-alt-del

Currently the generated inittab doesn't have a line for the three finger salute, and hence no action is taken on ctrl-alt-del, even when a normal PC-style target is used with VTs enabled and a real keyboard connected.

If someone enables USE_VT then lets assume they might actually intend to use the VTs and connect a keyboard and want ctrl-alt-del support. In keeping with the SYSVINIT_ENABLED_GETTYS option, we make it optional, since for some situations (kiosk etc.) it may not be desired to be enabled.

---
 meta/conf/documentation.conf                           | 1 +
 meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb | 7 +++++++
 2 files changed, 8 insertions(+)
meta/conf/documentation.conf +1 -0
index 7fa3f318b959..ba5505790a9e 100644
@@ -396,6 +396,7 @@ SYSROOT_PREPROCESS_FUNCS[doc] = "A list of functions to execute after files are
 SYSTEMD_AUTO_ENABLE[doc] = "For recipes that inherit the systemd class, this variable specifies whether the service you have specified in SYSTEMD_SERVICE should be started automatically or not."
 SYSTEMD_PACKAGES[doc] = "For recipes that inherit the systemd class, this variable locates the systemd unit files when they are not found in the main recipe's package."
 SYSTEMD_SERVICE[doc] = "For recipes that inherit the systemd class, this variable specifies the systemd service name for a package."
+SYSVINIT_ENABLED_CTRLALTDEL[doc] = "Specifies if virtual terminals should trap on ctrl-alt-del and reboot, the default is '0'."
 SYSVINIT_ENABLED_GETTYS[doc] = "Specifies which virtual terminals should be running a getty, the default is '1'."
 
 #T
meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb +7 -0
index c3244b46021e..334f9f1ad4b0 100644
@@ -38,6 +38,12 @@ do_install() {
 #
 
 EOF
+        if [ "${SYSVINIT_ENABLED_CTRLALTDEL}" = "1" ]; then
+            cat <<EOF >>${D}${sysconfdir}/inittab
+ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
+
+EOF
+        fi
 
         for n in ${SYSVINIT_ENABLED_GETTYS}
         do
@@ -77,6 +83,7 @@ CONFFILES_${PN} = "${sysconfdir}/inittab"
 
 USE_VT ?= "1"
 SYSVINIT_ENABLED_GETTYS ?= "1"
+SYSVINIT_ENABLED_CTRLALTDEL ?= "0"
 
 
 
Signature · 1 line
1.9.1