-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a script to build the dmg from a tar file containing the signed app
- Loading branch information
Showing
3 changed files
with
84 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ex | ||
|
||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
|
||
# Default values | ||
ARCH="" | ||
VERSION="" | ||
TAR_FILE="" | ||
|
||
# Function to show usage | ||
usage() { | ||
echo "Usage: $0 --arch <architecture> --version <version> <tar-file>" | ||
exit 1 | ||
} | ||
|
||
# Parse arguments | ||
while [[ "$#" -gt 0 ]]; do | ||
case "$1" in | ||
--arch) | ||
ARCH="$2" | ||
shift 2 | ||
;; | ||
--version) | ||
VERSION="$2" | ||
shift 2 | ||
;; | ||
--help) | ||
usage | ||
;; | ||
*) | ||
if [[ -z "$TAR_FILE" ]]; then | ||
TAR_FILE="$1" | ||
else | ||
echo "Unexpected argument: $1" | ||
usage | ||
fi | ||
shift | ||
;; | ||
esac | ||
done | ||
|
||
# Validate inputs | ||
if [[ -z "$ARCH" || -z "$VERSION" || -z "$TAR_FILE" ]]; then | ||
echo "Error: Missing required arguments." | ||
usage | ||
fi | ||
|
||
if [[ ! -f "$TAR_FILE" ]]; then | ||
echo "Error: TAR file does not exist." | ||
exit 1 | ||
fi | ||
|
||
move_pharo_launcher_app_to_the_current_directory() { | ||
find . -name PharoLauncher.app -print0 | xargs -0 -I{} mv {} . | ||
} | ||
|
||
clean_up() { | ||
echo "Cleaning up temporary files." | ||
rm -rf "$TMP_DIR" | ||
} | ||
|
||
TMP_DIR=$(mktemp -d) | ||
tar -xf "$TAR_FILE" -C "$TMP_DIR" | ||
pushd "$TMP_DIR" | ||
move_pharo_launcher_app_to_the_current_directory | ||
chmod +x PharoLauncher.app/Contents/MacOS/Pharo PharoLauncher.app/Contents/Resources/pharo-launcher || true | ||
ARCHITECTURE=$ARCH VERSION=$VERSION APP_NAME=PharoLauncher "$SCRIPT_DIR"/build-dmg.sh | ||
generated_dmg=$(echo *.dmg) | ||
popd | ||
mv "$TMP_DIR"/"$generated_dmg" "PharoLauncher-${VERSION}-${ARCH}.dmg" | ||
generated_dmg=$(echo *.dmg) | ||
md5 "$generated_dmg" > "$generated_dmg.md5sum" | ||
echo "DMG created: $generated_dmg" | ||
clean_up |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters