#!/bin/bash # change the values below to match your system. # target the BUILD_DIR to output from an nw.io build process. nwjs-shell-builder recommended! # https://github.com/Gisto/nwjs-shell-builder # BASE_DIR is the target directory for this script, where files will be gathered and packaged to BUILD_DIR=”/var/www/deploy/TMP/osx-ia32/latest-git” BASE_DIR=”/var/www/deploy/osx”  VERSION=”your_app_version" IDENTIFIER=”your.app.desc.com” APPNAME=”Your ApplicationName” BACKGROUND=”/var/www/yourApp/img/installerbackground.png” rm -rf “$BASE_DIR/darwin” mkdir -p “$BASE_DIR/darwin/flat/Resources/en.lproj” mkdir -p “$BASE_DIR/darwin/flat/base.pkg/” mkdir -p “$BASE_DIR/darwin/root/Applications” cp -R $BUILD_DIR/*.* $BASE_DIR/darwin/root/Applications cp $BACKGROUND $BASE_DIR/darwin/flat/Resources/en.lproj/background NUM_FILES=$(find ${BASE_DIR}/darwin/root | wc -l) INSTALL_KB_SIZE=$(du -k -s ${BASE_DIR}/darwin/root | awk ‘{print $1}’) cat < ${BASE_DIR}/darwin/flat/base.pkg/PackageInfo                   EOF cat < ${BASE_DIR}/darwin/flat/Distribution  ${APPNAME} ${VERSION}                        #base.pkg EOF PKG_LOCATION=”${BASE_DIR}/${APPNAME}-${VERSION}.pkg” ( cd ${BASE_DIR}/darwin/root && find . | cpio -o — format odc — owner 0:80 | gzip -c ) > ${BASE_DIR}/darwin/flat/base.pkg/Payload mkbom -u 0 -g 80 ${BASE_DIR}/darwin/root ${BASE_DIR}/darwin/flat/base.pkg/Bom  ( cd ${BASE_DIR}/darwin/flat/ && xar — compression none -cf “${PKG_LOCATION}” * )  echo “osx package has been built: ${PKG_LOCATION}”