1#!/bin/bash 2 3set -e 4 5if [ -z "$MAC_BUILD_CONFIG" ] 6then 7 MAC_BUILD_CONFIG=Release 8fi 9 10#set SIGN_BUILD=0 in the environment to not sign the .pkg files: 11# SIGN_BUILD=0 ./create_package.sh 12#or 13# SIGN_BUILD=0 ./make-mac.sh 14SIGN_BUILD=${SIGN_BUILD:-1} 15 16#get the release number 17source "$(pwd)/../../../scripts/mac/set_eidmw_version.sh" 18 19 20 21 22 23 24##################################################################### 25################## BEIDUninstaller name defines ########### 26#BEIDUninstaller name defines 27#release dir, where normally files to be released will be placed 28RELEASE_BEIDUNINSTALL_DIR="$(pwd)/release_BEIDUninstall" 29#root dir, for files that are to be installed by the pkg 30ROOT_BEIDUNINSTALL_DIR="$RELEASE_BEIDUNINSTALL_DIR/root" 31 32#uninstall scripts dir, where the install scripts are that will be executed by the package 33BEIDUNINSTALL_SCRIPTS_DIR="$RELEASE_BEIDUNINSTALL_DIR/install_scripts" 34#licenses dir, where the licenses are that will be showed by the package 35BEIDUNINSTALL_LICENSES_DIR="$RELEASE_BEIDUNINSTALL_DIR/licenses" 36#resources dir, for files that are to be kept inside the pkg 37BEIDUNINSTALL_RESOURCES_DIR="$RELEASE_BEIDUNINSTALL_DIR/resources" 38##################################################################### 39 40 41#base name of the package 42REL_NAME="eID-Quick-Uninstaller" 43#version number of the package 44 45BUILD_NR=$(git rev-list --count HEAD) 46PKG_NAME="$REL_NAME.pkg" 47PKGSIGNED_NAME="${REL_NAME}-signed.pkg" 48VOL_NAME="${REL_NAME}-${REL_VERSION}" 49DMG_NAME="${REL_NAME}-${REL_VERSION}.dmg" 50 51 52#cleanup previous build 53 54if test -e "$RELEASE_BEIDUNINSTALL_DIR"; then 55 rm -rdf "$RELEASE_BEIDUNINSTALL_DIR" 56fi 57if test -e $PKG_NAME; then 58 rm $PKG_NAME 59fi 60 61 62##################################################################### 63echo "********** prepare beiduninstall.pkg **********" 64 65#create uninstaller dirs 66mkdir -p "$BEIDUNINSTALL_SCRIPTS_DIR" 67mkdir -p "$BEIDUNINSTALL_LICENSES_DIR" 68mkdir -p "$BEIDUNINSTALL_RESOURCES_DIR" 69mkdir -p "$ROOT_BEIDUNINSTALL_DIR" 70 71 72#copy all files that should be part of the installer: 73 74#copy licenses 75cp -R ./resources/* $BEIDUNINSTALL_RESOURCES_DIR 76 77#overwrite the readme files 78cp -R ./uninstall_resources/* $BEIDUNINSTALL_RESOURCES_DIR 79 80#copy uninstall scripts 81cp -R ./uninstall_scripts/* "$BEIDUNINSTALL_SCRIPTS_DIR" 82 83#copy distribution file 84cp Distribution_Uninstall.txt "$RELEASE_BEIDUNINSTALL_DIR/Distribution_Uninstall.txt" 85 86echo "********** generate $PKG_NAME and $DMG_NAME **********" 87 88 89#build the packages in the release dir 90pushd $RELEASE_BEIDUNINSTALL_DIR 91 92pkgbuild --root "$ROOT_BEIDUNINSTALL_DIR" --scripts "$BEIDUNINSTALL_SCRIPTS_DIR" --identifier be.eid.uninstall --version $REL_VERSION --install-location / BEIDUninstall.pkg 93 94productbuild --distribution "$RELEASE_BEIDUNINSTALL_DIR/Distribution_Uninstall.txt" --resources "$BEIDUNINSTALL_RESOURCES_DIR" $PKG_NAME 95 96##################################################################### 97 98if [ $SIGN_BUILD -eq 1 ];then 99 productsign --sign "Developer ID Installer" $PKG_NAME $PKGSIGNED_NAME 100 hdiutil create -srcfolder $PKGSIGNED_NAME -volname "${VOL_NAME}" $DMG_NAME 101 exit 1 102else 103 hdiutil create -srcfolder $PKG_NAME -volname "${VOL_NAME}" $DMG_NAME 104fi 105 106 107popd 108