diff --git a/installer_mac/make_installer.sh b/installer_mac/make_installer.sh index 32b875bd422..da326fb26b7 100755 --- a/installer_mac/make_installer.sh +++ b/installer_mac/make_installer.sh @@ -35,9 +35,11 @@ RSRCS="../resources/data" OUTPUT_BASE_FILENAME="Surge-$VERSION-Setup" +TARGET_DIR="installer"; + build_flavor() { - TMPDIR=installer/tmp-pkg + TMPDIR=${TARGET_DIR}/tmp-pkg flavor=$1 flavorprod=$2 ident=$3 @@ -52,7 +54,7 @@ build_flavor() # The defaults only work if a component is a sole entry in a staging directory though, so synthesize that # by moving the product to a tmp dir - mkdir $TMPDIR + mkdir -p $TMPDIR mv $PRODUCTS/$flavorprod $TMPDIR pkgbuild --root $TMPDIR --identifier $ident --version $VERSION --install-location $loc Surge_${flavor}.pkg || exit 1 @@ -142,19 +144,19 @@ XMLEND # build installation bundle -if [[ ! -d installer ]]; then - mkdir installer +if [[ ! -d ${TARGET_DIR} ]]; then + mkdir ${TARGET_DIR} fi -productbuild --distribution distribution.xml --package-path "./" --resources Resources "installer/$OUTPUT_BASE_FILENAME.pkg" +productbuild --distribution distribution.xml --package-path "./" --resources Resources "${TARGET_DIR}/$OUTPUT_BASE_FILENAME.pkg" # create a DMG if required if [[ $2 == "--dmg" ]]; then - if [[ -f "$OUTPUT_BASE_FILENAME.dmg" ]]; then - rm "$OUTPUT_BASE_FILENAME.dmg" + if [[ -f "${TARGET_DIR}/$OUTPUT_BASE_FILENAME.dmg" ]]; then + rm "${TARGET_DIR}/$OUTPUT_BASE_FILENAME.dmg" fi - hdiutil create /tmp/tmp.dmg -ov -volname "$OUTPUT_BASE_FILENAME" -fs HFS+ -srcfolder "./installer/" - hdiutil convert /tmp/tmp.dmg -format UDZO -o "$OUTPUT_BASE_FILENAME.dmg" + hdiutil create /tmp/tmp.dmg -ov -volname "$OUTPUT_BASE_FILENAME" -fs HFS+ -srcfolder "./${TARGET_DIR}/" + hdiutil convert /tmp/tmp.dmg -format UDZO -o "${TARGET_DIR}/$OUTPUT_BASE_FILENAME.dmg" fi # clean up