This repository was archived by the owner on May 6, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,21 +9,30 @@ PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
99BUILD_DIR=" $SCRIPT_DIR /build"
1010DIST_DIR=" $PROJECT_ROOT /dist"
1111VERSION=" 1.0.0"
12+ SCRIPTS_DIR=" $BUILD_DIR /scripts"
1213
1314rm -rf " $BUILD_DIR "
1415mkdir -p " $BUILD_DIR /payload/usr/local/lib/agent-pack"
1516mkdir -p " $DIST_DIR "
17+ mkdir -p " $SCRIPTS_DIR "
1618
1719# Copy project files into payload
1820cp -R " $PROJECT_ROOT /shared" " $BUILD_DIR /payload/usr/local/lib/agent-pack/shared"
1921cp -R " $PROJECT_ROOT /config" " $BUILD_DIR /payload/usr/local/lib/agent-pack/config"
2022mkdir -p " $BUILD_DIR /payload/usr/local/lib/agent-pack/linux"
2123cp -R " $PROJECT_ROOT /linux/lib" " $BUILD_DIR /payload/usr/local/lib/agent-pack/linux/lib"
2224
25+ # pkgbuild requires runnable preinstall/postinstall scripts. Stage them in a
26+ # temp directory with executable permissions so the macOS package runs
27+ # reliably regardless of repo mode bits.
28+ cp " $SCRIPT_DIR /scripts/preinstall.sh" " $SCRIPTS_DIR /preinstall"
29+ cp " $SCRIPT_DIR /scripts/postinstall.sh" " $SCRIPTS_DIR /postinstall"
30+ chmod 755 " $SCRIPTS_DIR /preinstall" " $SCRIPTS_DIR /postinstall"
31+
2332# Build component package
2433pkgbuild \
2534 --root " $BUILD_DIR /payload" \
26- --scripts " $SCRIPT_DIR /scripts " \
35+ --scripts " $SCRIPTS_DIR " \
2736 --identifier " com.agentpack.pkg" \
2837 --version " $VERSION " \
2938 " $BUILD_DIR /AgentPack.pkg"
Original file line number Diff line number Diff line change 44
55set -e
66
7+ POSTINSTALL_LOG=" /private/tmp/agent-pack-postinstall.log"
8+ mkdir -p " $( dirname " $POSTINSTALL_LOG " ) "
9+ exec >> " $POSTINSTALL_LOG " 2>&1
10+ echo " "
11+ echo " [$( date ' +%Y-%m-%d %H:%M:%S' ) ] Starting Agent Pack macOS postinstall"
12+
713INSTALL_DIR=" /usr/local/lib/agent-pack"
814SHARED_DIR=" $INSTALL_DIR /shared"
915CONFIG_DIR=" $INSTALL_DIR /config"
Original file line number Diff line number Diff line change 66
77echo " [Agent Pack] Pre-install: checking prerequisites..."
88
9+ # Installer runs with a stripped PATH on many macOS systems, so expose common
10+ # Homebrew locations before checking for brew.
11+ if [ -x /opt/homebrew/bin/brew ]; then
12+ eval " $( /opt/homebrew/bin/brew shellenv) "
13+ elif [ -x /usr/local/bin/brew ]; then
14+ export PATH=" /usr/local/bin:/usr/local/sbin:$PATH "
15+ fi
16+
917# Xcode Command Line Tools
1018if ! xcode-select -p & > /dev/null; then
1119 echo " "
You can’t perform that action at this time.
0 commit comments