mac:use of bash [[ instead of bsd [

This commit is contained in:
Richard Barber 2020-02-24 10:31:47 -08:00
parent 9445e62ed7
commit c7b4f6fc67

View File

@ -39,7 +39,7 @@ function ModifyInstallNames {
msg "Modifying install names: ${x}"
{
# id
if [ ${x:(-6)} == ".dylib" ] || [ f${x:(-3)} == ".so" ]; then
if [[ ${x:(-6)} == ".dylib" ]] || [[ f${x:(-3)} == ".so" ]]; then
install_name_tool -id /Applications/"${LIB}"/$(basename ${x}) ${x}
fi
GetDependencies "${x}" | while read -r y
@ -51,13 +51,13 @@ function ModifyInstallNames {
}
# Source check
if [[ ! -d "${CMAKE_BUILD_TYPE}" ]]; then
if [[ ! -d ${CMAKE_BUILD_TYPE} ]]; then
msgError "${PWD}/${CMAKE_BUILD_TYPE} folder does not exist. Please execute 'make install' first."
exit 1
fi
# Update project version
if [[ -x "$(which git)" && -d "${PROJECT_SOURCE_DIR}/.git" ]]; then
if [[ -x $(which git) && -d ${PROJECT_SOURCE_DIR}/.git ]]; then
### This section is copied from tools/generateReleaseInfo
# Get version description.
# Depending on whether you checked out a branch (dev) or a tag (release),
@ -87,7 +87,7 @@ if [[ -x "$(which git)" && -d "${PROJECT_SOURCE_DIR}/.git" ]]; then
fi
MINIMUM_SYSTEM_VERSION="$(otool -l "${CMAKE_BUILD_TYPE}"/MacOS/rawtherapee | grep -A2 'LC_VERSION_MIN_MACOSX' | awk '$1 ~ /version/ { printf $2 }')"
if [[ -z "${MINIMUM_SYSTEM_VERSION}" ]]; then
if [[ -z ${MINIMUM_SYSTEM_VERSION} ]]; then
MINIMUM_SYSTEM_VERSION="$(sw_vers -productVersion | cut -d. -f-2)"
fi
@ -270,7 +270,7 @@ install_name_tool -delete_rpath RawTherapee.app/Contents/Frameworks "${EXECUTABL
install_name_tool -add_rpath @executable_path "${EXECUTABLE}"-cli
# Codesign the app
if [ -n "${CODESIGNID}" ] ; then
if [[ -n ${CODESIGNID} ]]; then
msg "Codesigning Application."
install -m 0644 "${PROJECT_SOURCE_DATA_DIR}"/rt.entitlements "${CMAKE_BUILD_TYPE}"/rt.entitlements
plutil -convert binary1 "${CMAKE_BUILD_TYPE}"/rt.entitlements
@ -283,7 +283,7 @@ if [ -n "${CODESIGNID}" ] ; then
fi
# Notarize the app
if [ -n "$NOTARY" ] ; then
if [[ -n $NOTARY ]]; then
msg "Notarizing the application:"
ditto -c -k --sequesterRsrc --keepParent "${APP}" "${APP}.zip"
uuid=`xcrun altool --notarize-app --primary-bundle-id "com.rawtherapee.RawTherapee" ${NOTARY} --file "${APP}.zip" 2>&1 | grep 'RequestUUID' | awk '{ print $3 }'`
@ -293,12 +293,12 @@ if [ -n "$NOTARY" ] ; then
do
fullstatus=`xcrun altool --notarization-info "$uuid" ${NOTARY} 2>&1` # get the status
status1=`echo "$fullstatus" | grep 'Status\:' | awk '{ print $2 }'`
if [ "$status1" = "success" ]; then
if [[ $status1 = "success" ]]; then
xcrun stapler staple *app # staple the ticket
xcrun stapler validate -v *app
echo "Notarization success"
break
elif [ "$status1" = "in" ]; then
elif [[ $status1 = "in" ]]; then
echo "Notarization still in progress, sleeping for 15 seconds and trying again"
sleep 15
else
@ -335,7 +335,7 @@ function CreateDmg {
fi
msg "Creating disk image:"
if [ ! -z ${FANCY_DMG} ] ; then
if [[ ! -z ${FANCY_DMG} ]]; then
echo "Building Fancy .dmg"
mkdir "${srcDir}/.background"
cp -R "${PROJECT_SOURCE_DATA_DIR}/rtdmg.icns" "${srcDir}/.VolumeIcon.icns"
@ -354,7 +354,7 @@ function CreateDmg {
fi
# Sign disk image
if [ -n "$CODESIGNID" ] ; then
if [[ -n $CODESIGNID ]]; then
codesign --deep --force -v -s "${CODESIGNID}" --timestamp "${dmg_name}.dmg"
fi
@ -369,12 +369,12 @@ function CreateDmg {
do
fullstatus=`xcrun altool --notarization-info "$uuid" ${NOTARY} 2>&1` # get the status
status1=`echo "$fullstatus" | grep 'Status\:' | awk '{ print $2 }'`
if [ "$status1" = "success" ]; then
if [[ $status1 = "success" ]]; then
xcrun stapler staple "${dmg_name}.dmg" # staple the ticket
xcrun stapler validate -v "${dmg_name}.dmg"
echo "dmg Notarization success"
break
elif [ "$status1" = "in" ]; then
elif [[ $status1 = "in" ]]; then
echo "dmg Notarization still in progress, sleeping for 15 seconds and trying again"
sleep 15
else