forked from osmocom/wireshark
85 lines
1.6 KiB
Bash
Executable File
85 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# The script creates a disk image using the dmgbuild utility and signs it.
|
|
|
|
set -e
|
|
|
|
# Defaults
|
|
dmgbuild="@DMGBUILD_EXECUTABLE@"
|
|
version="@VERSION@"
|
|
settings_file="@CMAKE_BINARY_DIR@/packaging/macosx/dmgbuild-settings.py"
|
|
architecture=""
|
|
|
|
# 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.
|
|
"
|
|
}
|
|
|
|
if [ ! -x "$dmgbuild" ] ; then
|
|
echo "Error: \"$dmgbuild\" not found."
|
|
exit 1
|
|
fi
|
|
|
|
if lipo Wireshark.app/Contents/MacOS/Wireshark -verify_arch arm64 ; then
|
|
architecture="Arm 64"
|
|
elif lipo Wireshark.app/Contents/MacOS/Wireshark -verify_arch x86_64 ; then
|
|
architecture="Intel 64"
|
|
else
|
|
echo "Error: Wireshark.app missing or has unknown architecture."
|
|
lipo Wireshark.app/Contents/MacOS/Wireshark -detailed_info
|
|
exit 1
|
|
fi
|
|
|
|
# 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"
|
|
fi
|
|
|
|
exit 0
|