1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

Mac: Refactor OS X dmg creation and misc bug fixes (#2226)

This commit is contained in:
Marti Martz 2017-02-18 12:58:26 -07:00 committed by David Rosca
parent 5fe3efab82
commit 2e1db33c3f
6 changed files with 88 additions and 16 deletions

1
.gitignore vendored
View File

@ -12,6 +12,7 @@ headers*.tar.gz
license_template license_template
Makefile* Makefile*
bin/qupzilla bin/qupzilla
bin/QupZilla.dmg
lib*.so* lib*.so*
bin/core bin/core
qupzilla.sh qupzilla.sh

Binary file not shown.

36
mac/create_dmg.scpt Normal file
View File

@ -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

View File

@ -1,26 +1,61 @@
#!/bin/bash #!/bin/bash
TMP=/tmp
BUNDLE_PATH=bin BUNDLE_PATH=bin
test -d bin || BUNDLE_PATH=../bin test -d bin || BUNDLE_PATH=../bin
echo "We just want to make sure it's not in use" WORK_TEMPLATE=tmp-QupZilla-release.dmg.sparseimage
hdiutil detach /tmp/tmp-release-qupzilla
echo "Creating writable DMG from template" # NOTE: Value must currently match -volname exactly or an error happens in AppleScript with Finder
hdiutil convert QupZilla-template.dmg -format UDRW -o /tmp/tmp-qupzilla.dmg VOLUME_TEMPLATE=QupZilla
echo "Attach DMG for write" echo "Ensuring working disk image template is not in use…"
hdiutil attach /tmp/tmp-qupzilla.dmg -mountpoint /tmp/tmp-qupzilla-release hdiutil detach $TMP/$WORK_TEMPLATE
echo "Copying…" echo "Creating writable working disk image template…"
cp -fpR $BUNDLE_PATH/QupZilla.app/Contents /tmp/tmp-qupzilla-release/QupZilla.app 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…" echo "Creating background image folder…"
rm $BUNDLE_PATH/QupZilla.dmg mkdir "$TMP/$VOLUME_TEMPLATE/.background"
hdiutil convert /tmp/tmp-qupzilla.dmg -format UDBZ -o $BUNDLE_PATH/QupZilla.dmg
echo "Removing temp files…" echo "Copying background image…"
rm /tmp/tmp-qupzilla.dmg cp images/qupzilla-dmg-background.png "$TMP/$VOLUME_TEMPLATE/.background/"
exit
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"

View File

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

View File

@ -42,7 +42,7 @@ answer=$( while ! head -c 1 | grep -i '[yn]'; do true; done )
stty $old_stty_cfg stty $old_stty_cfg
if echo "$answer" | grep -iq "^y"; then if echo "$answer" | grep -iq "^y"; then
if [ -z ${QTDIR+x} ]; then if [ -z ${QTDIR+x} ]; then
printf '\nPlease set the environment variable for the Qt platform folder.\n\texample:\n\t$ export QTDIR="$HOME/Qt/5.7/clang_64"\n' printf '\nPlease set the environment variable for the Qt platform folder.\n\texample:\n\t$ export QTDIR="$HOME/Qt/5.8/clang_64"\n'
exit 1 exit 1
else else
printf '\nCopying known, missing, Qt native library plugins to target bundle...\n' printf '\nCopying known, missing, Qt native library plugins to target bundle...\n'