Skip to content

Commit

Permalink
fix mac pkg installer error
Browse files Browse the repository at this point in the history
zhengyangliu committed Jul 12, 2024
1 parent 161fa28 commit cf08093
Showing 3 changed files with 10 additions and 8 deletions.
6 changes: 4 additions & 2 deletions buildResources/build-pkg.sh
Original file line number Diff line number Diff line change
@@ -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
3 changes: 1 addition & 2 deletions buildResources/mac-scripts/postinstall
Original file line number Diff line number Diff line change
@@ -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"
9 changes: 5 additions & 4 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -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 <<EOF > "$LAUNCH_AGENT_PLIST"
@@ -29,7 +30,7 @@ if [[ "$(uname)" == "Darwin" ]]; then
<string>launchctl</string>
<string>setenv</string>
<string>OPENBLOCK_EXTERNAL_RESOURCES</string>
<string>"$INSTALL_DIR"</string>
<string>$INSTALL_DIR</string>
</array>
<key>RunAtLoad</key>
<true/>

0 comments on commit cf08093

Please sign in to comment.