From bf98b8784c640937eeb91f8783e0f573939fdd20 Mon Sep 17 00:00:00 2001 From: EnderIce2 Date: Wed, 29 May 2024 22:55:02 +0300 Subject: [PATCH] Fix formatting and remove unnecessary recursive rm's --- build/launchd.sh | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/build/launchd.sh b/build/launchd.sh index eeabea0..6c4ff71 100755 --- a/build/launchd.sh +++ b/build/launchd.sh @@ -1,6 +1,6 @@ #!/bin/sh -# This script is used to create a LaunchAgent on MacOS, to support the service functionnality. +# This script is used to create a LaunchAgent on MacOS, to support the service functionality. # Usage: ./launchd.sh (install|remove) SYMLINK=/tmp/rpc-bridge/tmpdir @@ -16,7 +16,7 @@ function install() { if [ ! -d "$LOCATION" ]; then mkdir -p "$LOCATION" fi - + # Link script if [ -f "$SCRIPT" ]; then rm -f "$SCRIPT" @@ -27,9 +27,9 @@ if [ ! -d "\$TARGET_DIR" ]; then mkdir -p "\$TARGET_DIR" fi rm -rf "\$TARGET_DIR" - ln -s "\$TMPDIR" "\$TARGET_DIR"" > "$SCRIPT" +ln -s "\$TMPDIR" "\$TARGET_DIR"" > "$SCRIPT" chmod +x "$SCRIPT" - + # LaunchAgent if [ -f "$AGENT" ]; then rm -f "$AGENT" @@ -50,13 +50,12 @@ rm -rf "\$TARGET_DIR" " > "$AGENT" launchctl load "$AGENT" echo "LaunchAgent has been installed." - } function remove() { - rm -rf "$SYMLINK" - rm -rf "$LOCATION" + rm -f "$SYMLINK" rm -f "$SCRIPT" + rmdir "$LOCATION" if [ -f "$AGENT" ]; then launchctl unload "$AGENT" fi @@ -81,4 +80,4 @@ case $1 in echo "Invalid argument. Please use 'install' or 'remove'." exit 1 ;; -esac \ No newline at end of file +esac