From a0615229ef55d1706761dcb47f3a1d953bba37c2 Mon Sep 17 00:00:00 2001 From: EnderIce2 Date: Fri, 25 Apr 2025 03:42:34 +0300 Subject: [PATCH] Add installation checks to launchd.sh for improved user feedback --- build/launchd.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/build/launchd.sh b/build/launchd.sh index dca51b8..c65479d 100755 --- a/build/launchd.sh +++ b/build/launchd.sh @@ -8,6 +8,16 @@ LOCATION=~/Library/Application\ Support/rpc-bridge SCRIPT=$LOCATION/rpc-bridge AGENT=~/Library/LaunchAgents/com.enderice2.rpc-bridge.plist +function is_installed() { + if [ -f "$AGENT" ]; then + launchctl list | grep -q "com.enderice2.rpc-bridge" + if [ $? -eq 0 ]; then + return 0 + fi + fi + return 1 +} + function install() { # Directories if [ ! -d "$SYMLINK" ]; then @@ -71,9 +81,16 @@ fi case $1 in install) + if is_installed; then + echo "LaunchAgent is already installed." + exit 0 + fi install ;; remove) + if ! is_installed; then + echo "LaunchAgent is not installed. Continuing anyway." + fi remove ;; *)