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

login
register
mail settings
Submitter Paul Gortmaker
Date June 6, 2014, 6:41 p.m.
Message ID <1402080064-16450-1-git-send-email-paul.gortmaker@windriver.com>
Download mbox | patch
Permalink /patch/73453/
State New
Headers show

Comments

Paul Gortmaker - June 6, 2014, 6:41 p.m.
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.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 meta/conf/documentation.conf                           | 1 +
 meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb | 7 +++++++
 2 files changed, 8 insertions(+)

Patch

diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf
index 7fa3f318b959..ba5505790a9e 100644
--- a/meta/conf/documentation.conf
+++ b/meta/conf/documentation.conf
@@ -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
diff --git a/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb b/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
index c3244b46021e..334f9f1ad4b0 100644
--- a/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
+++ b/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
@@ -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"