Skip to content
Snippets Groups Projects
Commit 8820e6de authored by poka's avatar poka
Browse files

add script to install macos bin

parent 439c267c
Branches poka/dev
Tags 0.2.13
No related merge requests found
Pipeline #37131 passed
......@@ -31,7 +31,7 @@ build_linux:
build_macos:
stage: build_macos
image: poka/rust-osxcross:1.0.2
image: poka/rust-osxcross:latest
script:
# Install the required dependencies
- rustup target add x86_64-apple-darwin
......@@ -41,9 +41,13 @@ build_macos:
- rm -rf target/macos
- mkdir -p target/macos
- cargo bundle --release --target x86_64-apple-darwin
# Zip the gcli.app before moving it
# Add Info.plist and install_gcli.scpt
- cd target/x86_64-apple-darwin/release/bundle/osx
- echo -e "Unzip gcli.zip and move the gcli.app folder to /Applications/ folder.\nenjoy" > instructions.txt
- mkdir -p gcli.app/Contents/Resources/Scripts
- cp /opt/Info.plist gcli.app/Contents/Info.plist
- cp /opt/install_gcli.scpt gcli.app/Contents/Resources/Scripts/install_gcli.scpt
- echo -e "Just unzip gcli.app and open it.\nenjoy" > instructions.txt
# Zip the gcli.app before moving it
- zip -r gcli.zip gcli.app instructions.txt
- mv gcli.zip ../../../../macos/ # target/macos/
artifacts:
......
......@@ -44,5 +44,9 @@ ENV CXX="o64-clang++"
# Add rust target for macOS
RUN rustup target add x86_64-apple-darwin
# Copy scripts
COPY scripts/install_gcli.scpt /opt/install_gcli.scpt
COPY scripts/Info.plist /opt/Info.plist
# Define the entrypoint
CMD ["bash"]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDisplayName</key>
<string>gcli</string>
<key>CFBundleExecutable</key>
<string>osascript</string>
<key>CFBundleIdentifier</key>
<string>com.axiomteam.gcli</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>gcli</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.2.13</string>
<key>CFBundleVersion</key>
<string>20240522.234244</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>LSRequiresCarbon</key>
<true/>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSAppleScriptEnabled</key>
<true/>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>gcli script</string>
<key>CFBundleURLSchemes</key>
<array>
<string>file</string>
</array>
</dict>
</array>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>scpt</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>ScriptEditorAppIcon.icns</string>
<key>CFBundleTypeName</key>
<string>AppleScript</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>osascript</string>
<key>CFBundleScriptPath</key>
<string>Contents/Resources/Scripts/install_gcli.scpt</string>
</dict>
</plist>
-- Ask user if they want to install gcli
set userResponse to display dialog "Do you want to install gcli to /usr/local/bin?" buttons {"No", "Yes"} default button "Yes"
if button returned of userResponse is "Yes" then
-- Run shell script to move gcli with administrator privileges
try
do shell script "mv gcli.app/Contents/MacOS/gcli /usr/local/bin" with administrator privileges
display dialog "gcli has been installed to /usr/local/bin and is now available in your PATH."
on error errMsg number errorNumber
if errorNumber is -128 then
display dialog "Installation cancelled."
else
display dialog "An error occurred: " & errMsg
end if
end try
else
display dialog "Installation cancelled."
end if
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment