Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 7875eda

Browse files
Fix issue postinstaller not run in macos (#1212)
* Fix issue postinstaller not run in macos * Correct download llamacpp command --------- Co-authored-by: Hien To <tominhhien97@gmail.com> Co-authored-by: Service Account <service@jan.ai>
1 parent b363db3 commit 7875eda

File tree

5 files changed

+18
-8
lines changed

5 files changed

+18
-8
lines changed

.github/workflows/nightly-build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ jobs:
9797

9898
update-latest-version:
9999
runs-on: ubuntu-latest
100+
if: needs.set-public-provider.outputs.public_provider == 'aws-s3'
100101
needs: [get-update-version, set-public-provider, build-linux-x64, build-macos-x64, build-macos-arm64, build-windows-x64]
101102
steps:
102103
- name: Update latest version

.github/workflows/template-build-macos.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: build-mac-x64
1+
name: build-mac
22
on:
33
workflow_call:
44
inputs:
@@ -174,13 +174,18 @@ jobs:
174174
run: |
175175
cd engine
176176
make build-installer PACKAGE_NAME="${{ steps.set-output-params.outputs.package_name }}" VERSION=${{ inputs.new_version }} SOURCE_BINARY_PATH="../../cortex/${{ steps.set-output-params.outputs.destination_binary_name }}" DESTINATION_BINARY_NAME="${{ steps.set-output-params.outputs.destination_binary_name }}" DATA_FOLDER_NAME="${{ steps.set-output-params.outputs.data_folder_name }}" CONFIGURATION_FILE_NAME="${{ steps.set-output-params.outputs.configuration_file_name }}" UNINSTALLER_FILE_NAME="${{ steps.set-output-params.outputs.uninstaller_file_name }}"
177+
cat templates/macos/Scripts/postinstall
177178
178179
- name: Codesign and notary for macos installer
179180
run: |
180181
cd engine
181182
productsign --sign "Developer ID Installer: ${{ secrets.DEVELOPER_ID }}" ${{ steps.set-output-params.outputs.package_name }}.pkg ${{ steps.set-output-params.outputs.package_name }}$-signed.pkg
182183
rm ${{ steps.set-output-params.outputs.package_name }}.pkg
183-
mv ${{ steps.set-output-params.outputs.package_name }}$-signed.pkg ${{ steps.set-output-params.outputs.package_name }}.pkg
184+
mv ${{ steps.set-output-params.outputs.package_name }}$-signed.pkg Distribution.pkg
185+
productbuild --synthesize --package Distribution.pkg Distribution.xml
186+
sed -i '' 's/require-scripts="false"/require-scripts="true"/' Distribution.xml
187+
cat Distribution.xml
188+
productbuild --distribution Distribution.xml --sign "Developer ID Installer: ${{ secrets.DEVELOPER_ID }}" --package-path . ${{ steps.set-output-params.outputs.package_name }}.pkg
184189
xcrun notarytool submit ${{ steps.set-output-params.outputs.package_name }}.pkg --apple-id ${{ secrets.APPLE_ID }} --password ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }} --team-id ${{ secrets.APPLE_TEAM_ID }} --wait
185190
186191
- name: Package

engine/templates/macos/cortex-uninstall.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env sh
22
DESTINATION_BINARY_NAME=cortex
33
DATA_FOLDER_NAME=.cortex
44
CONFIGURATION_FILE_NAME=.cortexrc

engine/templates/macos/create_pkg.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ CONFIGURATION_FILE_NAME=$6
77
UNINSTALLER_FILE_NAME=$7
88

99
mkdir installer
10-
mkdir scripts
10+
mkdir Scripts
1111

1212
cp $SOURCE_BINARY_PATH installer/$DESTINATION_BINARY_NAME
1313

1414
export DESTINATION_BINARY_NAME
15-
cp post-installer.sh scripts/post-installer.sh
16-
sed -i '' '2s/.*/DESTINATION_BINARY_NAME=\$DESTINATION_BINARY_NAME/' $PACKAGE_NAME/DEBIAN/postinst
15+
cp postinstall Scripts/postinstall
16+
sed -i '' "3s/.*/DESTINATION_BINARY_NAME=$DESTINATION_BINARY_NAME/" Scripts/postinstall
17+
chmod +x Scripts/postinstall
1718

1819
export DATA_FOLDER_NAME CONFIGURATION_FILE_NAME UNINSTALLER_FILE_NAME
1920
cp cortex-uninstall.sh installer/$UNINSTALLER_FILE_NAME
@@ -22,4 +23,4 @@ sed -i '' "3s/.*/DATA_FOLDER_NAME=$DATA_FOLDER_NAME/" installer/$UNINSTALLER_FIL
2223
sed -i '' "4s/.*/CONFIGURATION_FILE_NAME=$CONFIGURATION_FILE_NAME/" installer/$UNINSTALLER_FILE_NAME
2324
sed -i '' "5s/.*/UNINSTALLER_FILE_NAME=$UNINSTALLER_FILE_NAME/" installer/$UNINSTALLER_FILE_NAME
2425

25-
pkgbuild --identifier ai.cortexcpp.pkg --version $VERSION --scripts scripts --install-location /usr/local/bin --root ./installer ${PACKAGE_NAME}.pkg
26+
pkgbuild --identifier ai.cortexcpp.pkg --version $VERSION --scripts Scripts --install-location /usr/local/bin --root ./installer ${PACKAGE_NAME}.pkg
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
#!/bin/bash
1+
#!/usr/bin/env sh
2+
set -e
23
DESTINATION_BINARY_NAME=cortex
34
USER_TO_RUN_AS=${SUDO_USER:-$(whoami)}
45
echo "Download cortex.llamacpp engines by default"
56
sudo -u $USER_TO_RUN_AS /usr/local/bin/$DESTINATION_BINARY_NAME engines install cortex.llamacpp
7+
8+
exit 0

0 commit comments

Comments
 (0)