Mac: Refactor OS X dmg creation and misc bug fixes (#2226)
parent
5fe3efab82
commit
2e1db33c3f
6 changed files with 88 additions and 16 deletions
Binary file not shown.
@ -0,0 +1,36 @@ |
||||
tell application "Finder" |
||||
tell disk "QupZilla" |
||||
open |
||||
# Set some defaults |
||||
set current view of container window to icon view |
||||
|
||||
# Turn some things off |
||||
set statusbar visible of container window to false |
||||
set toolbar visible of container window to false |
||||
|
||||
# Size metrics { x, y, w, h } |
||||
set the bounds of container window to {40, 40, 520, 520} |
||||
|
||||
# Abstract an object |
||||
set theViewOptions to the icon view options of container window |
||||
|
||||
# Turn some more things off |
||||
set arrangement of theViewOptions to not arranged |
||||
|
||||
# Set background image in HFS+ format referenced from image bundle |
||||
set background picture of theViewOptions to file ".background:qupzilla-dmg-background.png" |
||||
|
||||
# Align the icons to the background mask |
||||
set icon size of theViewOptions to 64 |
||||
|
||||
set position of item "QupZilla" of container window to {55, 390} |
||||
set position of item "Applications" of container window to {390, 390} |
||||
|
||||
# Since this is a dynamic template modifier script tell Finder not to do any registration of applications |
||||
update without registering applications |
||||
|
||||
delay 5 |
||||
|
||||
close |
||||
end tell |
||||
end tell |
||||
@ -1,26 +1,61 @@ |
||||
#!/bin/bash |
||||
|
||||
TMP=/tmp |
||||
BUNDLE_PATH=bin |
||||
test -d bin || BUNDLE_PATH=../bin |
||||
|
||||
echo "We just want to make sure it's not in use" |
||||
hdiutil detach /tmp/tmp-release-qupzilla |
||||
WORK_TEMPLATE=tmp-QupZilla-release.dmg.sparseimage |
||||
|
||||
echo "Creating writable DMG from template" |
||||
hdiutil convert QupZilla-template.dmg -format UDRW -o /tmp/tmp-qupzilla.dmg |
||||
# NOTE: Value must currently match -volname exactly or an error happens in AppleScript with Finder |
||||
VOLUME_TEMPLATE=QupZilla |
||||
|
||||
echo "Attach DMG for write" |
||||
hdiutil attach /tmp/tmp-qupzilla.dmg -mountpoint /tmp/tmp-qupzilla-release |
||||
echo "Ensuring working disk image template is not in use…" |
||||
hdiutil detach $TMP/$WORK_TEMPLATE |
||||
|
||||
echo "Copying…" |
||||
cp -fpR $BUNDLE_PATH/QupZilla.app/Contents /tmp/tmp-qupzilla-release/QupZilla.app |
||||
echo "Creating writable working disk image template…" |
||||
hdiutil create -size 200m "$TMP/$WORK_TEMPLATE" -type SPARSE -fs HFS+ -volname "QupZilla" |
||||
|
||||
hdiutil detach /tmp/tmp-qupzilla-release |
||||
echo "Attaching working disk image template for modification…" |
||||
hdiutil attach "$TMP/$WORK_TEMPLATE" -mountpoint "$TMP/$VOLUME_TEMPLATE" |
||||
|
||||
echo "Creating final compressed(bz2) DMG…" |
||||
rm $BUNDLE_PATH/QupZilla.dmg |
||||
hdiutil convert /tmp/tmp-qupzilla.dmg -format UDBZ -o $BUNDLE_PATH/QupZilla.dmg |
||||
echo "Creating background image folder…" |
||||
mkdir "$TMP/$VOLUME_TEMPLATE/.background" |
||||
|
||||
echo "Removing temp files…" |
||||
rm /tmp/tmp-qupzilla.dmg |
||||
exit |
||||
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" |
||||
|
||||
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
Loading…
Reference in new issue