sq epan/dissectors/pidl/rcg/rcg.cnf
[wireshark-sm.git] / packaging / macosx / osx-dmg.sh.in
blob030ec38666ee8587c9e458a2aa4b7e6115bc2cee
1 #!/bin/bash
3 # The script creates a disk image using the dmgbuild utility and signs it.
5 set -e
7 # Defaults
8 app_name="Wireshark"
9 dmgbuild="@DMGBUILD_EXECUTABLE@"
10 version="@PROJECT_VERSION@"
11 log_version="@LOG_PROJECT_VERSION@"
12 app_settings_file="@CMAKE_BINARY_DIR@/packaging/macosx/wireshark-app.dmgbuild"
13 dsym_settings_file="@CMAKE_BINARY_DIR@/packaging/macosx/wireshark-dsym.dmgbuild"
14 architecture=""
16 # Help message
17 #----------------------------------------------------------
18 help()
20 echo -e "
21 Create a custom dmg file to distribute Wireshark
23 USAGE
26 OPTIONS
27 -h,--help
28 Display this help message.
30 Icons are positioned and the background image is set in wireshark-app.dmgbuild.in
31 and wireshark-dsym.dmgbuild.in.
35 if [ ! -x "$dmgbuild" ] ; then
36 echo "Error: \"$dmgbuild\" not found."
37 exit 1
40 # Parse command line arguments
41 while [ "$1" != "" ]
43 case $1 in
44 -a|--app-name)
45 shift 1
46 app_name="$1"
48 -h|--help)
49 help
50 exit 0 ;;
52 echo "Invalid command line option"
53 exit 2 ;;
54 esac
55 shift 1
56 done
58 if lipo "$app_name.app/Contents/MacOS/$app_name" -verify_arch arm64 ; then
59 architecture="Arm 64"
60 elif lipo "$app_name.app/Contents/MacOS/$app_name" -verify_arch x86_64 ; then
61 architecture="Intel 64"
62 else
63 echo "Error: $app_name.app missing or has unknown architecture."
64 lipo "$app_name.app/Contents/MacOS/$app_name" -detailed_info
65 exit 1
68 if [[ $app_name = Strato* ]] ; then
69 version=$log_version
70 app_settings_file="@CMAKE_BINARY_DIR@/packaging/macosx/stratoshark-app.dmgbuild"
71 dsym_settings_file="@CMAKE_BINARY_DIR@/packaging/macosx/stratoshark-dsym.dmgbuild"
74 app_vol_name="$app_name ${version}"
75 app_img_name="$app_vol_name $architecture.dmg"
77 printf "\nCreating application disk image %s\n" "$app_img_name"
79 "$dmgbuild" \
80 --no-hidpi \
81 -s "$app_settings_file" \
82 "$app_vol_name" \
83 "$app_img_name" || exit 1
85 dsym_vol_name="$app_name dSYM ${version}"
86 dsym_img_name="$dsym_vol_name $architecture.dmg"
88 printf "\nCreating debugging symbols disk image %s\n" "$dsym_img_name"
90 "$dmgbuild" \
91 --no-hidpi \
92 -s "$dsym_settings_file" \
93 "$dsym_vol_name" \
94 "$dsym_img_name" || exit 1
96 printf "\nSigning disk images\n"
98 # TN2206, "Signing Disk Images"
99 if [ -n "$CODE_SIGN_IDENTITY" ] ; then
100 echo -e "Signing $app_img_name and $dsym_img_name"
101 codesign \
102 --sign "Developer ID Application: $CODE_SIGN_IDENTITY" \
103 --timestamp \
104 --verbose \
105 "$app_img_name" "$dsym_img_name"
108 exit 0