]> git.r.bdr.sh - rbdr/captura/blob - scripts/package.sh
477693a072a6d97744297b323a65a37d400af2e2
[rbdr/captura] / scripts / package.sh
1 #!/usr/bin/env bash
2
3 set -e
4
5
6 if [ "$#" -ne 2 ]; then
7 echo "Usage: $0 <project_name> <build_directory>"
8 exit 1
9 fi
10
11 project_name="$1"
12 build_directory="$2"
13
14 app_path="${build_directory}/${project_name}.app"
15 app_version=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" ${app_path}/Contents/Info.plist)
16 tmp_dir=$(mktemp -d)
17 dmg_path="${build_directory}/${project_name}-${app_version}.dmg"
18 cp -R "${app_path}" "${tmp_dir}"
19 ln -s /Applications "${tmp_dir}/Applications"
20 hdiutil create -volname "${project_name}" -srcfolder "${tmp_dir}" -ov -format UDZO "${dmg_path}"
21 rm -rf "${tmp_dir}"