Add the Flutter video editing application with project management, media import, timeline editing, preview, AI assistance, diagnostics and settings. Include shared UI and native host packages, platform runners, application tests and release tooling. Provide usage and contribution guides, the MIT license and third-party notices. Exclude local credentials, build outputs and validation data.
62 lines
1.6 KiB
Bash
62 lines
1.6 KiB
Bash
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
if [ "$#" -eq 1 ] && { [ "$1" = "--help" ] || [ "$1" = "-h" ]; }; then
|
|
echo "Usage: $0 <cutdex.app> <output.dmg>"
|
|
exit 0
|
|
fi
|
|
|
|
if [[ $# -ne 2 ]]; then
|
|
echo "Usage: $0 <cutdex.app> <output.dmg>" >&2
|
|
exit 2
|
|
fi
|
|
|
|
app="$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
|
|
output="$2"
|
|
|
|
if [[ ! -f "$app/Contents/Info.plist" ]]; then
|
|
echo "Missing macOS application: $app" >&2
|
|
exit 1
|
|
fi
|
|
icon="$app/Contents/Resources/AppIcon.icns"
|
|
if [[ ! -f "$icon" ]]; then
|
|
echo "Missing application icon: $icon" >&2
|
|
exit 1
|
|
fi
|
|
if [[ "$output" != *.dmg ]]; then
|
|
echo "Output must have a .dmg extension: $output" >&2
|
|
exit 2
|
|
fi
|
|
|
|
mkdir -p "$(dirname "$output")"
|
|
output="$(cd "$(dirname "$output")" && pwd)/$(basename "$output")"
|
|
stage="$(mktemp -d "${TMPDIR:-/tmp}/cutdex-dmg.XXXXXX")"
|
|
source="$stage/source"
|
|
mount="$stage/mounted"
|
|
mounted=false
|
|
cleanup() {
|
|
if [[ "$mounted" == true ]]; then
|
|
hdiutil detach -quiet "$mount" || true
|
|
fi
|
|
rm -rf "$stage"
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
mkdir "$source" "$mount"
|
|
ditto "$app" "$source/$(basename "$app")"
|
|
ln -s /Applications "$source/Applications"
|
|
ditto "$icon" "$source/.VolumeIcon.icns"
|
|
hdiutil create -quiet -format UDRW -volname Cutdex -srcfolder "$source" "$stage/uncompressed.dmg"
|
|
hdiutil attach -quiet -readwrite -nobrowse -mountpoint "$mount" "$stage/uncompressed.dmg"
|
|
mounted=true
|
|
xcrun SetFile -a C "$mount"
|
|
hdiutil detach -quiet "$mount"
|
|
mounted=false
|
|
hdiutil convert -quiet "$stage/uncompressed.dmg" -format UDZO -o "$output" -ov
|
|
hdiutil verify -quiet "$output"
|
|
swift "$(dirname "$0")/set_macos_file_icon.swift" "$icon" "$output"
|
|
|
|
echo "DMG: $output"
|
|
shasum -a 256 "$output"
|