From cf08093d4a4686ca5f5a1c498584052223a5a771 Mon Sep 17 00:00:00 2001 From: Arthur Zheng <869705086@qq.com> Date: Fri, 12 Jul 2024 10:46:02 +0800 Subject: [PATCH] fix mac pkg installer error --- buildResources/build-pkg.sh | 6 ++++-- buildResources/mac-scripts/postinstall | 3 +-- setup.sh | 9 +++++---- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/buildResources/build-pkg.sh b/buildResources/build-pkg.sh index b4082db..afb3e3e 100755 --- a/buildResources/build-pkg.sh +++ b/buildResources/build-pkg.sh @@ -22,12 +22,14 @@ while read -r line; do EXCLUDES="$EXCLUDES --exclude='$line'" done < "$IGNORE_FILE" +echo $EXCLUDES + eval rsync -av $EXCLUDES "$SOURCE_DIR/" "$BUILD_DIR/" -pkgbuild --root ./ \ +pkgbuild --root ./dist/pkg/ \ --identifier openblock.cc.openblock-external-resource \ --version $VERSION \ - --install-location ~/Library/OpenBlockExternalResources \ + --install-location /Library/OpenBlockExternalResources \ --ownership recommended \ --scripts buildResources/mac-scripts \ ./dist/OpenBlock-External-Resources-v$VERSION.pkg diff --git a/buildResources/mac-scripts/postinstall b/buildResources/mac-scripts/postinstall index f6b5941..fed6b47 100755 --- a/buildResources/mac-scripts/postinstall +++ b/buildResources/mac-scripts/postinstall @@ -1,7 +1,6 @@ #!/bin/bash -CURRENT_USER=$(ls -l /dev/console | awk '{print $3}') -INSTALL_DIR="/Users/$CURRENT_USER/Library/OpenBlockExternalResources" +INSTALL_DIR="/Library/OpenBlockExternalResources" if [ -x "$INSTALL_DIR/setup.sh" ]; then "$INSTALL_DIR/setup.sh" diff --git a/setup.sh b/setup.sh index a1a75ba..4da097e 100755 --- a/setup.sh +++ b/setup.sh @@ -10,11 +10,12 @@ fi # Get the directory where the current script is located INSTALL_DIR="$(cd "$(dirname "$0")" && pwd -P)" -# Path to the Launch Agent plist file -LAUNCH_AGENT_PLIST=~/Library/LaunchAgents/openblock.cc.openblockExternalResource.setenv.plist - # Check if the system is macOS if [[ "$(uname)" == "Darwin" ]]; then + + # Path to the Launch Agent plist file + LAUNCH_AGENT_PLIST=/Library/LaunchAgents/openblock.cc.openblockExternalResource.setenv.plist + # Create Launch Agent plist file mkdir -p $(dirname "$LAUNCH_AGENT_PLIST") cat < "$LAUNCH_AGENT_PLIST" @@ -29,7 +30,7 @@ if [[ "$(uname)" == "Darwin" ]]; then launchctl setenv OPENBLOCK_EXTERNAL_RESOURCES - "$INSTALL_DIR" + $INSTALL_DIR RunAtLoad