2014-02-05 01:37:26 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-02-18 20:58:26 +01:00
|
|
|
TMP=/tmp
|
2014-02-05 01:37:26 +01:00
|
|
|
BUNDLE_PATH=bin
|
|
|
|
test -d bin || BUNDLE_PATH=../bin
|
|
|
|
|
2017-02-18 20:58:26 +01:00
|
|
|
WORK_TEMPLATE=tmp-QupZilla-release.dmg.sparseimage
|
2014-02-05 01:37:26 +01:00
|
|
|
|
2017-02-18 20:58:26 +01:00
|
|
|
# NOTE: Value must currently match -volname exactly or an error happens in AppleScript with Finder
|
|
|
|
VOLUME_TEMPLATE=QupZilla
|
2014-02-05 01:37:26 +01:00
|
|
|
|
2017-02-18 20:58:26 +01:00
|
|
|
echo "Ensuring working disk image template is not in use…"
|
|
|
|
hdiutil detach $TMP/$WORK_TEMPLATE
|
2014-02-05 01:37:26 +01:00
|
|
|
|
2017-02-18 20:58:26 +01:00
|
|
|
echo "Creating writable working disk image template…"
|
|
|
|
hdiutil create -size 200m "$TMP/$WORK_TEMPLATE" -type SPARSE -fs HFS+ -volname "QupZilla"
|
2014-02-05 01:37:26 +01:00
|
|
|
|
2017-02-18 20:58:26 +01:00
|
|
|
echo "Attaching working disk image template for modification…"
|
|
|
|
hdiutil attach "$TMP/$WORK_TEMPLATE" -mountpoint "$TMP/$VOLUME_TEMPLATE"
|
2014-02-05 01:37:26 +01:00
|
|
|
|
2017-02-18 20:58:26 +01:00
|
|
|
echo "Creating background image folder…"
|
|
|
|
mkdir "$TMP/$VOLUME_TEMPLATE/.background"
|
2014-02-05 01:37:26 +01:00
|
|
|
|
2017-02-18 20:58:26 +01:00
|
|
|
echo "Copying background image…"
|
|
|
|
cp images/qupzilla-dmg-background.png "$TMP/$VOLUME_TEMPLATE/.background/"
|
|
|
|
|
|
|
|
echo "Creating volume icon set…"
|
|
|
|
iconutil -c icns images/qupzilla-dmg-icon.iconset -o "$TMP/$VOLUME_TEMPLATE/.VolumeIcon.icns"
|
|
|
|
|
|
|
|
echo "Creating application reference folder…"
|
|
|
|
mkdir "$TMP/$VOLUME_TEMPLATE/QupZilla.app"
|
|
|
|
|
|
|
|
echo "Creating symbolic link to global Applications folder…"
|
|
|
|
ln -s /Applications "$TMP/$VOLUME_TEMPLATE/Applications"
|
|
|
|
|
|
|
|
echo "Setting some proprietary window modifications here with AppleScript…"
|
|
|
|
osascript create_dmg.scpt
|
|
|
|
|
|
|
|
sleep 5
|
|
|
|
|
|
|
|
echo "Registering that a custom icon has been set…"
|
|
|
|
SetFile -a C "$TMP/$VOLUME_TEMPLATE"
|
|
|
|
|
|
|
|
echo "Copying application bundle contents…"
|
|
|
|
cp -fpR "$BUNDLE_PATH/QupZilla.app/Contents" "$TMP/$VOLUME_TEMPLATE/QupZilla.app"
|
|
|
|
|
|
|
|
echo "Blessing folder to automatically open on mount…"
|
|
|
|
bless -folder "$TMP/$VOLUME_TEMPLATE" --openfolder "$TMP/$VOLUME_TEMPLATE"
|
|
|
|
|
|
|
|
echo "Detaching working disk image template from write…"
|
|
|
|
hdiutil detach "$TMP/$VOLUME_TEMPLATE"
|
|
|
|
|
|
|
|
echo "Compacting working disk image…"
|
|
|
|
hdiutil compact "$TMP/$WORK_TEMPLATE"
|
|
|
|
|
|
|
|
echo "Converting working disk image to read only…"
|
|
|
|
rm "$BUNDLE_PATH/QupZilla.dmg"
|
|
|
|
hdiutil convert "$TMP/$WORK_TEMPLATE" -format UDBZ -o "$BUNDLE_PATH/QupZilla.dmg"
|
|
|
|
|
|
|
|
echo "Cleaning up"
|
|
|
|
rm "$TMP/$WORK_TEMPLATE"
|