commit:     a8619d18c9cf6b8ac82eb06f7a98d2f21bc1b240
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 13 06:31:51 2025 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Apr 13 06:32:18 2025 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=a8619d18

scripts/auto-bootstraps/dobootstrap: fix keepalive for Sequoia

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 scripts/auto-bootstraps/dobootstrap | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/scripts/auto-bootstraps/dobootstrap 
b/scripts/auto-bootstraps/dobootstrap
index 682a7927d9..b8b808bf23 100755
--- a/scripts/auto-bootstraps/dobootstrap
+++ b/scripts/auto-bootstraps/dobootstrap
@@ -184,10 +184,13 @@ if [[ -z ${BP_KEEPALIVE_ACTIVE} ]] ; then
        # optional program to keep the machine from sleeping
        # macOS/BSD: caffeinate
        keepalive=$(type -P caffeinate)
-       [[ -x ${keepalive} ]] && keepalive+=" -i -m -s" || keepalive=
+       [[ -e ${keepalive} ]] && keepalive+=" -i -m -s" || keepalive=
        if [[ -n ${keepalive} ]] ; then
                export BP_KEEPALIVE_ACTIVE=1
-               exec ${keepalive} "${BASH_SOURCE[0]}" "${@}"
+               # starting from Sequoia letting caffeinate spawn the script
+               # doesn't seem to work any more, so keep a co-buddy to watch
+               # this script
+               ${keepalive} -w $$ &
        fi
 fi
 
@@ -203,6 +206,11 @@ case $1 in
                export RESUME=1
                do_prepare "$2" "${3:-${BOOTSTRAP_DATE}}"
                ;;
+       check)
+               echo "Just checking."
+               ps ax | grep caffeinate
+               exit
+               ;;
        *)
                bitw=
                if [[ ${0} == /net/* || ${0} == /System/* ]] ; then

Reply via email to