This repository was archived by the owner on Jul 4, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +36
-17
lines changed Expand file tree Collapse file tree 5 files changed +36
-17
lines changed Original file line number Diff line number Diff line change 5959 cp build/cortex cortex/;
6060endif
6161
62- codesign :
62+ codesign-binary :
6363ifeq ($(CODE_SIGN ) ,false)
6464 @echo "Skipping Code Sign"
6565 @exit 0
@@ -68,12 +68,11 @@ endif
6868ifeq ($(OS ) ,Windows_NT)
6969 @powershell -Command "dotnet tool install --global AzureSignTool;"
7070 @powershell -Command 'azuresigntool.exe sign -kvu "$(AZURE_KEY_VAULT_URI)" -kvi "$(AZURE_CLIENT_ID)" -kvt "$(AZURE_TENANT_ID)" -kvs "$(AZURE_CLIENT_SECRET)" -kvc "$(AZURE_CERT_NAME)" -tr http://timestamp.globalsign.com/tsa/r6advanced1 -v ".\cortex\cortex.exe";'
71- @powershell -Command 'azuresigntool.exe sign -kvu "$(AZURE_KEY_VAULT_URI)" -kvi "$(AZURE_CLIENT_ID)" -kvt "$(AZURE_TENANT_ID)" -kvs "$(AZURE_CLIENT_SECRET)" -kvc "$(AZURE_CERT_NAME)" -tr http://timestamp.globalsign.com/tsa/r6advanced1 -v ".\cortex\engines\cortex.llamacpp\engine.dll";'
7271else ifeq ($(shell uname -s),Linux)
7372 @echo "Skipping Code Sign for linux"
7473 @exit 0
7574else
76- find "cortex" -type f -exec codesign --force -s "$(DEVELOPER_ID)" --options=runtime {} \ ;
75+ codesign --force -s "$(DEVELOPER_ID)" --options=runtime --entitlements="./templates/macos/entitlements.plist" ./cortex/cortex ;
7776endif
7877
7978package :
Original file line number Diff line number Diff line change @@ -2,15 +2,27 @@ PACKAGE_NAME=$1
22VERSION=$2
33SOURCE_BINARY_PATH=$3
44DESTINATION_BINARY_NAME=$4
5+ DATA_FOLDER_NAME=$5
6+ CONFIGURATION_FILE_NAME=$6
57
68mkdir -p $PACKAGE_NAME /DEBIAN
79
810mkdir -p $PACKAGE_NAME /usr/bin
911cp $SOURCE_BINARY_PATH $PACKAGE_NAME /usr/bin/$DESTINATION_BINARY_NAME
1012
13+ export DESTINATION_BINARY_NAME
14+
1115cp postinst $PACKAGE_NAME /DEBIAN/postinst
12- cp postrm $PACKAGE_NAME /DEBIAN/postrm
16+ sed -i ' 2s/.*/DESTINATION_BINARY_NAME=\$DESTINATION_BINARY_NAME/' $PACKAGE_NAME /DEBIAN/postinst
17+
1318cp prerm $PACKAGE_NAME /DEBIAN/prerm
19+ sed -i ' 3s/.*/DESTINATION_BINARY_NAME=\$DESTINATION_BINARY_NAME/' $PACKAGE_NAME /DEBIAN/prerm
20+
21+ export DATA_FOLDER_NAME CONFIGURATION_FILE_NAME
22+
23+ cp postrm $PACKAGE_NAME /DEBIAN/postrm
24+ sed -i ' 3s/.*/DATA_FOLDER_NAME=\$DATA_FOLDER_NAME/' $PACKAGE_NAME /DEBIAN/postrm
25+ sed -i ' 3s/.*/CONFIGURATION_FILE_NAME=\$CONFIGURATION_FILE_NAME/' $PACKAGE_NAME /DEBIAN/postrm
1426
1527chmod 755 $PACKAGE_NAME /DEBIAN/postinst
1628chmod 755 $PACKAGE_NAME /DEBIAN/postrm
Original file line number Diff line number Diff line change 11#! /bin/sh
2- echo " Running post-install script..."
2+ DESTINATION_BINARY_NAME=cortex
3+ echo " Download cortex.llamacpp engines by default"
4+ USER_TO_RUN_AS=${SUDO_USER:- $(whoami)}
5+ sudo -u " $USER_TO_RUN_AS " /usr/bin/$DESTINATION_BINARY_NAME engines cortex.llamacpp install
Original file line number Diff line number Diff line change 11#! /bin/sh
22set +e
3+ DATA_FOLDER_NAME=.cortex
4+ CONFIGURATION_FILE_NAME=.cortexrc
35
4- echo " Do you want to delete the 'cortex ' data folder for all users ? (yes/no)"
6+ echo " Do you want to delete the '~/ ${DATA_FOLDER_NAME} ' data folder and file '~/ ${CONFIGURATION_FILE_NAME} ' ? (yes/no)"
57read -r answer
68
9+ USER_TO_RUN_AS=${SUDO_USER:- $(whoami)}
10+
711case " $answer " in
812 [yY][eE][sS]|[yY])
9- echo " Deleting 'cortex' data folders..."
10- for userdir in /home/* ; do
11- if [ -d " $userdir /cortex" ]; then
12- echo " Removing $userdir /cortex"
13- rm -rf " $userdir /cortex" > /dev/null 2>&1
14- fi
15- done
13+ echo " Deleting cortex data folders..."
14+ if [ -d " /home/${USER_TO_RUN_AS} /${DATA_FOLDER_NAME} " ]; then
15+ echo " Removing /home/${USER_TO_RUN_AS} /${DATA_FOLDER_NAME} "
16+ rm -rf " /home/${USER_TO_RUN_AS} /${DATA_FOLDER_NAME} " > /dev/null 2>&1
17+ fi
18+ if [ -f " /home/${USER_TO_RUN_AS} /${CONFIGURATION_FILE_NAME} " ]; then
19+ echo " Removing /home/${USER_TO_RUN_AS} /${CONFIGURATION_FILE_NAME} "
20+ rm -f " /home/${USER_TO_RUN_AS} /${CONFIGURATION_FILE_NAME} " > /dev/null 2>&1
21+ fi
1622 ;;
1723 [nN][oO]|[nN])
1824 echo " Keeping the 'cortex' data folders."
@@ -21,5 +27,4 @@ case "$answer" in
2127 echo " Invalid response. Please type 'yes' or 'no'."
2228 ;;
2329esac
24-
2530exit 0
Original file line number Diff line number Diff line change 11#! /bin/sh
22set +e
3-
4- /usr/bin/cortex stop > /dev/null 2>&1
5-
3+ DESTINATION_BINARY_NAME=cortex
4+ USER_TO_RUN_AS= ${SUDO_USER :- $(whoami)}
5+ sudo -u " $USER_TO_RUN_AS " /usr/bin/ $DESTINATION_BINARY_NAME stop > /dev/null 2>&1
66exit 0
You can’t perform that action at this time.
0 commit comments