aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Deutschmann <whissi@gentoo.org>2021-03-14 16:58:17 +0100
committerThomas Deutschmann <whissi@gentoo.org>2021-03-14 20:34:08 +0100
commitd61b95fa199284170990948b3f0e51e32a213262 (patch)
treeed54cf819724f4374915bc859f3bfa94926a2271
parentlinuxrc: Rename rundebugshell() -> run_debug_shell() (diff)
downloadgenkernel-d61b95fa199284170990948b3f0e51e32a213262.tar.gz
genkernel-d61b95fa199284170990948b3f0e51e32a213262.tar.bz2
genkernel-d61b95fa199284170990948b3f0e51e32a213262.zip
initrd.scripts: Add is_userinteraction_allowed() function
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
-rw-r--r--defaults/initrd.scripts23
1 files changed, 18 insertions, 5 deletions
diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index 3be18b5..53cb633 100644
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -648,6 +648,15 @@ is_true() {
return 1
}
+is_userinteraction_allowed() {
+ if [ -f "${GK_USERINTERACTION_DISABLED_STATEFILE}" ]
+ then
+ return 1
+ fi
+
+ return 0
+}
+
# Function to create an ext2 fs on $aufs_dev, $aufs_dev_mnt mountpoint
create_changefs() {
local size
@@ -1012,15 +1021,19 @@ run_debug_shell() {
}
run_emergency_shell() {
- echo
- gksosreport
- good_msg 'You might want to save "/run/initramfs/gksosreport.txt" to a USB stick or /boot'
- good_msg 'after mounting them and attach it to a bug report.'
+ if is_userinteraction_allowed
+ then
+ echo
+ gksosreport
+ good_msg 'You might want to save "/run/initramfs/gksosreport.txt" to a USB stick or /boot'
+ good_msg 'after mounting them and attach it to a bug report.'
+ fi
+
run_shell
}
run_shell() {
- if [ -f "${GK_USERINTERACTION_DISABLED_STATEFILE}" ]
+ if ! is_userinteraction_allowed
then
bad_msg "gk.userinteraction.disabled is set; Spawning a shell is disabled!"
return