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 A9383138334 for ; Wed, 7 Aug 2019 15:46:21 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E9A22E08E5; Wed, 7 Aug 2019 15:46:15 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (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 ADA4DE08E5 for ; Wed, 7 Aug 2019 15:46:15 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (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 B42E334948C for ; Wed, 7 Aug 2019 15:46:14 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id B5B12766 for ; Wed, 7 Aug 2019 15:46:10 +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: <1565190224.bc7df5ee2b27d04889cacba49bb3339a58ce9de3.whissi@gentoo> Subject: [gentoo-commits] proj/genkernel:master commit in: defaults/ X-VCS-Repository: proj/genkernel X-VCS-Files: defaults/resume-boot.sh X-VCS-Directories: defaults/ X-VCS-Committer: whissi X-VCS-Committer-Name: Thomas Deutschmann X-VCS-Revision: bc7df5ee2b27d04889cacba49bb3339a58ce9de3 X-VCS-Branch: master Date: Wed, 7 Aug 2019 15:46:10 +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: 3c078ef1-8f2c-4382-ab30-596d6b3a887b X-Archives-Hash: 48327592a4b978ef0e042c0eb1826bf8 commit: bc7df5ee2b27d04889cacba49bb3339a58ce9de3 Author: Thomas Deutschmann gentoo org> AuthorDate: Tue Aug 6 18:21:45 2019 +0000 Commit: Thomas Deutschmann gentoo org> CommitDate: Wed Aug 7 15:03:44 2019 +0000 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=bc7df5ee Rework resume-boot.sh - We no longer use $GK_SHELL_LOCKFILE which was removed in in previous commit ("initrd.scripts: run_shell(): Use LOCK file"). - We now try to kill all $SH processes allowing to use resume-boot in remote and local rescue shell. Signed-off-by: Thomas Deutschmann gentoo.org> defaults/resume-boot.sh | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/defaults/resume-boot.sh b/defaults/resume-boot.sh index cb29831..f4dd4b2 100644 --- a/defaults/resume-boot.sh +++ b/defaults/resume-boot.sh @@ -1,15 +1,28 @@ #!/bin/sh . /etc/initrd.defaults +. /etc/initrd.scripts -if [ -s "${GK_SHELL_LOCKFILE}" ] +GK_INIT_LOG_PREFIX=${0} +if [ -n "${SSH_CLIENT_IP}" ] && [ -n "${SSH_CLIENT_PORT}" ] then - kill -9 "$(cat "${GK_SHELL_LOCKFILE}")" + GK_INIT_LOG_PREFIX="${0}[${SSH_CLIENT_IP}:${SSH_CLIENT_PORT}]" fi -if [ -f "${GK_SSHD_LOCKFILE}" ] -then - rm "${GK_SSHD_LOCKFILE}" -fi +# We don't want to kill init script (PID 1), +# ourselves and parent process yet... +pids_to_keep="1 ${$} ${PPID}" + +for pid in $(pgrep sh) +do + if ! echo " ${pids_to_keep} " | grep -q " ${pid} " + then + kill -9 ${pid} + fi +done + +good_msg "Resuming boot process ..." +[ -f "${GK_SSHD_LOCKFILE}" ] && run rm "${GK_SSHD_LOCKFILE}" +[ "${PPID}" != '1' ] && kill -9 ${PPID} exit 0