aboutsummaryrefslogtreecommitdiffstats
path: root/packaging/macosx/osx-dmg.sh.in
blob: 9967d83953796b20003989c160d7ecca366163ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
#
# The script creates a disk image using the dmgbuild utility and signs it.

# Defaults
dmgbuild="@DMGBUILD_EXECUTABLE@"
version="@VERSION@"
settings_file="@CMAKE_BINARY_DIR@/packaging/macosx/dmgbuild-settings.py"
architecture="Intel 64"

# Help message
#----------------------------------------------------------
help()
{
echo -e "
Create a custom dmg file to distribute Wireshark

USAGE
	$0

OPTIONS
	-h,--help
		Display this help message.

Icons are positioned and the background image is set in
dmgbuild-settings.py.in.
"
}

# Parse command line arguments
while [ "$1" != "" ]
do
	case $1 in
		-h|--help)
			help
			exit 0 ;;
		*)
			echo "Invalid command line option"
			exit 2 ;;
	esac
	shift 1
done

vol_name="Wireshark ${version}"
img_name="$vol_name $architecture.dmg"

echo -e "\\nCREATE WIRESHARK DISK IMAGE\\n"

"$dmgbuild" \
	--no-hidpi \
	-s "$settings_file" \
	"$vol_name" \
	"$img_name" || exit 1

echo -e "\\nSIGN WIRESHARK DISK IMAGE\\n"

# TN2206, "Signing Disk Images"
if [ -n "$CODE_SIGN_IDENTITY" ] ; then
	echo -e "Signing $img_name"
	codesign \
		--sign "Developer ID Application: $CODE_SIGN_IDENTITY" \
		--timestamp \
		--verbose \
		"$img_name"
	spctl --assess --type open --context context:primary-signature --verbose=2 "$img_name" || exit 1
fi

exit 0