Add installation checks to launchd.sh for improved user feedback

This commit is contained in:
EnderIce2 2025-04-25 03:42:34 +03:00
parent 18c422101b
commit a0615229ef
Signed by: enderice2
GPG Key ID: FEB6B8A8507BA62E

View File

@ -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
;;
*)