Commit 26c811a0 authored by Ivan Yossi's avatar Ivan Yossi 👌 Committed by Ashwin Dhakaita

packaging macOS: Allow to set different styles from command args

Styles for the dmg are stored on a different file and can be selected using
-style="style file path". By default, if no option is given "default.styles" is used.

Styles can be created using "dmgstyle.sh" script.
parent 20f6073c
......@@ -84,7 +84,7 @@ PY_VERSION="${local_PY_MAYOR_VERSION}.${local_PY_MINOR_VERSION}"
echo "Detected Python ${PY_VERSION}"
print_usage () {
echo "USAGE: osxdeploy.sh [-s=<identity>] [-style=<style.txt>] [-bg=<background-image>]"
echo "USAGE: osxdeploy.sh [-s=<identity>] <background-image>"
echo "\t -s Code sign identity for codesign"
echo "\t -style Style file defined from 'dmgstyle.sh' output"
echo "\t -bg Set a background image for dmg folder"
......@@ -92,6 +92,21 @@ print_usage () {
\t image recomended size is at least 950x500\n"
}
get_script_dir() {
script_source="${BASH_SOURCE[0]}"
# go to target until finding root.
while [ -L "${script_source}" ]; do
script_target="$(readlink ${script_source})"
if [[ "${script_source}" = /* ]]; then
script_source="$script_target"
else
script_dir="$(dirname "${script_source}")"
script_source="${script_dir}/${script_target}"
fi
done
echo "$(dirname ${script_source})"
}
# Attempt to detach previous mouted DMG
......@@ -145,7 +160,6 @@ for arg in "${@}"; do
done
if [[ ! ${DMG_STYLE} ]]; then
DMG_STYLE="${SCRIPT_SOURCE_DIR}/default.style"
fi
echo "Using style from: ${DMG_STYLE}"
......@@ -155,6 +169,7 @@ if [[ ${DMG_validBG} -eq 0 ]]; then
DMG_background="${SCRIPT_SOURCE_DIR}/krita_dmgBG.jpg"
fi
if [[ -z "${CODE_SIGNATURE}" ]]; then
echo "WARNING: No signature provided, Code will not be signed"
else
......@@ -552,11 +567,12 @@ createDMG () {
## Apple script to set style
style="$(<"${DMG_STYLE}")"
printf "${style}" "${DMG_title}" "${DMG_background##*/}" | osascript
tell application "Finder"
#Set Icon for DMG
cp -v "${SCRIPT_SOURCE_DIR}/KritaIcon.icns" "/Volumes/${DMG_title}/.VolumeIcon.icns"
SetFile -a C "/Volumes/${DMG_title}"
set current view of container window to icon view
set toolbar visible of container window to false
' "${DMG_title}" "${DMG_background##*/}" | osascript
chmod -Rf go-w "/Volumes/${DMG_title}"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment