homebrew/script/app-to-cask.sh

29 lines
760 B
Bash
Executable File

#!/bin/bash
# Assign arguments to variables
APP_FILE=$1
ZIP_PATH=$(basename $APP_FILE)
# S3_BUCKET="https://dl.breadone.xyz/cask"
S3_BUCKET="https://dl.breadone.xyz/homebrew/casks"
echo "compressing $APP_FILE to $ZIP_PATH.zip"
# Compress the file
ditto -c -k --sequesterRsrc --keepParent $APP_FILE $ZIP_PATH.zip
# Get hash of file
hash=$(sha256 $ZIP_PATH.zip | awk '{ print $4 }')
echo "SHA256: $hash"
# get reported version of app
version=$(mdls -name kMDItemVersion $APP_FILE | awk '{ print $3 }')
echo "Version: $version"
# Upload the .app file to the specified S3 bucket
curl -X PUT "$S3_BUCKET/$ZIP_PATH.zip" \
-H "Content-Type: application/octet-stream" \
--data-binary "@$ZIP_PATH.zip"
echo "Deleting $ZIP_PATH.zip..."
rm $ZIP_PATH.zip