From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 216D11382C5 for ; Sun, 14 Mar 2021 20:06:02 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 732EAE086C; Sun, 14 Mar 2021 20:06:01 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 5E75AE086C for ; Sun, 14 Mar 2021 20:06:01 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 8EB5A335DC0 for ; Sun, 14 Mar 2021 20:05:59 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id D4D005B4 for ; Sun, 14 Mar 2021 20:05:56 +0000 (UTC) From: "Thomas Deutschmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Thomas Deutschmann" Message-ID: <1615750448.d61b95fa199284170990948b3f0e51e32a213262.whissi@gentoo> Subject: [gentoo-commits] proj/genkernel:master commit in: defaults/ X-VCS-Repository: proj/genkernel X-VCS-Files: defaults/initrd.scripts X-VCS-Directories: defaults/ X-VCS-Committer: whissi X-VCS-Committer-Name: Thomas Deutschmann X-VCS-Revision: d61b95fa199284170990948b3f0e51e32a213262 X-VCS-Branch: master Date: Sun, 14 Mar 2021 20:05:56 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 871443fb-ddf0-4e42-8e20-9aa1ffefe077 X-Archives-Hash: 5bfefd61479d6e998cb2bc6262718923 commit: d61b95fa199284170990948b3f0e51e32a213262 Author: Thomas Deutschmann gentoo org> AuthorDate: Sun Mar 14 15:58:17 2021 +0000 Commit: Thomas Deutschmann gentoo org> CommitDate: Sun Mar 14 19:34:08 2021 +0000 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=d61b95fa initrd.scripts: Add is_userinteraction_allowed() function Signed-off-by: Thomas Deutschmann gentoo.org> defaults/initrd.scripts | 23 ++++++++++++++++++----- 1 file 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