+# make a relative path absolute as we'll be cd-ing to /tmp
+if [[ "${BACKGROUNDIMG#/}" = "${BACKGROUNDIMG}" ]]; then
+ BACKGROUNDIMG="${WDIR}/${BACKGROUNDIMG}"
+fi
+
+# Note that VOLNAME is only for making the DS_Store file in. The final DMG can have a different Volume name
+# This temporary VOLNAME can be seen if you do `strings /Volume/Your DMG Name/.DS_Store` on the final .DS_Store
+# so we set this to something relatable to the application name.
+VOLNAME="${NAME// /_}_Installer"
+
+APPNAME="${NAME}.app"
+
+DMG="${VOLNAME}.dmg"
+# We set the Applications folder link to " " in the DMG
+APPLICATIONSFOLDERLINK=" "
+
+VOLDIR="/Volumes/${VOLNAME}"
+# The directory and filename this temporary volume is mounted from can be seen in `strings .DS_Store` so we move out
+# of userspace for generic and security reasons.