this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #1584 from Lazerbeak12345/fix-stop-all-running-services

fix: stop all running darling servers on uninstall

authored by

CuriousTommy and committed by
GitHub
2c29d48d b31d38c6

+19 -9
+15 -4
tools/shutdown-user.sh
··· 1 + #!/bin/sh 2 + 3 + if [ "$(whoami)" != "root" ] 4 + then 5 + echo "$0 must be run as root, invoking sudo" 6 + exec sudo su -c "$0" "$@" 7 + fi 8 + 1 9 echo "Seeing if Darling is currently running" 2 10 3 - PID=`pgrep launchd` 11 + # Sometimes `pgrep launchd` doesn't work when `pgrep -f launchd` does. Not sure 12 + # if we want to include arguments (and capture rare, but possible false 13 + # positives). 14 + PID=$(pgrep -f launchd) 4 15 5 - while [[ ! -z $PID ]] 16 + while [ -n "$PID" ] 6 17 do 7 18 THISPID=$(echo $PID | head -n1) 8 19 RUNNING_USER=$(ps -o uname= -p $THISPID | head -n1) 9 20 echo "Darling currently running for $RUNNING_USER, shutting it down..." 10 - sudo -u $RUNNING_USER darling shutdown 21 + su --login "$RUNNING_USER" -c "darling shutdown" 11 22 sleep 2 12 - PID=`pgrep launchd` 23 + PID=$(pgrep -f launchd) 13 24 done 14 25 15 26 echo "No instances running now"
+4 -5
tools/uninstall
··· 4 4 if [ "$(whoami)" != "root" ] 5 5 then 6 6 echo "Uninstall must be run as root, invoking sudo" 7 - sudo su -c "$0" 8 - exit 7 + exec sudo su -c "$0" "$@" 9 8 fi 10 - 11 - INSTALL_PREFIX="$(dirname "$(dirname "$(which darling)")")" 12 9 13 10 if command -v darling 14 11 then 15 - darling shutdown 12 + $(dirname "$0")/shutdown-user.sh 16 13 fi 14 + 15 + INSTALL_PREFIX="$(dirname "$(dirname "$(which darling)")")" 17 16 if [ -d "${INSTALL_PREFIX}/libexec" ] 18 17 then 19 18 rm -rf "${INSTALL_PREFIX}/libexec/darling"