SPB Git

Repository Public License

package.sh 3.5 KB 73 lines shellscript

1#!/usr/bin/env bash2# =============================================================================3#                  SP BOUCHER | INFRASTRUCTURE & AUTOMATION4#             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project          : ORIX Monitor8# File             : Scripts/package.sh9# Description      : Builds dist/ORIX-Monitor-<version>.dmg (drag-to-install10#                    layout) and .zip from dist/ORIX Monitor.app, signs the DMG11#                    and writes SHA-256 checksums.12# Module           : Scripts13# Repository       : https://git.spboucher.ai/orix-monitor14# Created          : 2026-11-2115# Last Modified    : 2026-11-2116#17# Author           : Simon-Pierre Boucher18# Position         : Professor of Finance19# Institution      : Université du Québec en Outaouais (UQO)20# Organization     : SP Boucher21# Website          : https://spboucher.ai22# Git              : https://git.spboucher.ai23#24# Preferred Contact: support@spboucher.ai25# Technical Contact: dev@spboucher.ai26# Security/Admin   : admin@spboucher.ai27#28# Copyright (c) 202629# Simon-Pierre Boucher30# All rights reserved where applicable. This file is governed by the31# applicable project license, copyright notices and relevant law.32# Existing third-party rights and notices remain unaffected.33#34# License          : Proprietary, all rights reserved (see license file)35# License File     : LICENSE36#37# Do not embed credentials, private keys, access tokens,38# certificates or confidential personal information.39#40# =============================================================================41# END OF SP BOUCHER SOURCE HEADER42# =============================================================================4344set -euo pipefail45cd "$(dirname "$0")/.."46APP="dist/ORIX Monitor.app"47[[ -d "$APP" ]] || { echo "ERROR: $APP not found." >&2; exit 1; }48VERSION="$(/usr/libexec/PlistBuddy -c 'Print CFBundleShortVersionString' "$APP/Contents/Info.plist")"49DMG="dist/ORIX-Monitor-$VERSION.dmg"; ZIP="dist/ORIX-Monitor-$VERSION.zip"50IDENTITY="$(codesign -dvv "$APP" 2>&1 | sed -n 's/^Authority=\(Developer ID Application: .*\)$/\1/p' | head -1)"51[[ -n "$IDENTITY" ]] || { echo "ERROR: the app is not signed with a Developer ID identity." >&2; exit 1; }52make_zip() { rm -f "$ZIP"; ditto -c -k --keepParent "$APP" "$ZIP"; echo "built $ZIP"; }53make_dmg() {54  [[ -x build/tools/dmg-background ]] || { mkdir -p build/tools; swiftc -O Scripts/tools/dmg-background.swift -o build/tools/dmg-background; }55  build/tools/dmg-background build/dmg-background.png56  local stage; stage="$(mktemp -d)"; ditto "$APP" "$stage/ORIX Monitor.app"57  rm -f "$DMG"58  create-dmg --volname "ORIX Monitor $VERSION" --background build/dmg-background.png --window-pos 200 160 --window-size 660 440 \59    --icon-size 128 --icon "ORIX Monitor.app" 170 200 --app-drop-link 490 200 --hide-extension "ORIX Monitor.app" --no-internet-enable \60    "$DMG" "$stage" >/dev/null 2>build/create-dmg.err || { [[ -f "$DMG" ]] || { cat build/create-dmg.err >&2; exit 1; }; }61  rm -rf "$stage"62  codesign --force --timestamp --sign "$IDENTITY" "$DMG"63  codesign --verify "$DMG"; echo "built and signed $DMG"64}65make_checksums() { ( cd dist && shasum -a 256 "$(basename "$DMG")" "$(basename "$ZIP")" | tee SHA256SUMS.txt ); }66case "${1:-all}" in67  zip) make_zip ;;68  dmg) make_dmg ;;69  checksums) make_checksums ;;70  all) make_zip; make_dmg; make_checksums ;;71  *) echo "usage: $0 zip|dmg|checksums|all" >&2; exit 2 ;;72esac73
Files main
Menu

Theme