Skip to content

Commit

Permalink
add custom linux version
Browse files Browse the repository at this point in the history
  • Loading branch information
phnz committed Sep 29, 2015
1 parent 0a3e05d commit 4389bee
Showing 1 changed file with 84 additions and 0 deletions.
84 changes: 84 additions & 0 deletions mac/linux-dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#!/bin/bash
ROOTDIR='/var/lib/jenkins/workspace/Desktop'
BUILD_DIR="${ROOTDIR}/dist/VPN.ht-darwin-x64/"
BASE_DIR="${ROOTDIR}/dist"
PKG_DIR="${ROOTDIR}/util/mac/pkg"
VERSION=$(sed -n 's|\s*\"version\"\:\ \"\(.*\)\"\,|\1|p' ${ROOTDIR}/package.json)
IDENTIFIER="ht.vpn.desktop"
APPNAME="VPN.ht"

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/scripts"
mkdir -p "$BASE_DIR/darwin/root/Applications"
cp -R $BUILD_DIR/VPN.ht.app $BASE_DIR/darwin/root/Applications
cp -R $PKG_DIR/* $BASE_DIR/darwin/scripts
NUM_FILES=$(find ${BASE_DIR}/darwin/root | wc -l)
INSTALL_KB_SIZE=$(du -k -s ${BASE_DIR}/darwin/root | awk '{print $1}')

cat <<EOF > ${BASE_DIR}/darwin/flat/base.pkg/PackageInfo
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<pkg-info overwrite-permissions="true" relocatable="false" identifier="${IDENTIFIER}" postinstall-action="none" version="${VERSION}" format-version="2" generator-version="InstallCmds-502 (14C109)" auth="root" preserve-xattr="true">
<payload numberOfFiles="${NUM_FILES}" installKBytes="${INSTALL_KB_SIZE}"/>
<bundle path="./VPN.ht.app" id="${IDENTIFIER}" CFBundleShortVersionString="${VERSION}" CFBundleVersion="0"/>
<bundle-version>
<bundle id="${IDENTIFIER}"/>
</bundle-version>
<upgrade-bundle>
<bundle id="${IDENTIFIER}"/>
</upgrade-bundle>
<update-bundle/>
<atomic-update-bundle/>
<strict-identifier>
<bundle id="${IDENTIFIER}"/>
</strict-identifier>
<relocate>
<bundle id="${IDENTIFIER}"/>
</relocate>
<scripts>
<preinstall file="./preinstall"/>
<postinstall file="./postinstall"/>
</scripts>
</pkg-info>
EOF

cat <<EOF > ${BASE_DIR}/darwin/flat/Distribution
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<installer-gui-script minSpecVersion="2">
<pkg-ref id="${IDENTIFIER}">
<bundle-version>
<bundle CFBundleShortVersionString="${VERSION}" CFBundleVersion="0" id="${IDENTIFIER}" path="VPN.ht.app"/>
</bundle-version>
<must-close>
<app id="${IDENTIFIER}"/>
</must-close>
</pkg-ref>
<product id="${IDENTIFIER}" version="${VERSION}"/>
<title>VPN.ht</title>
<options customize="never" require-scripts="false" hostArchitectures="i386"/>
<volume-check>
<allowed-os-versions>
<os-version min="10.7"/>
</allowed-os-versions>
</volume-check>
<choices-outline>
<line choice="default">
<line choice="${IDENTIFIER}"/>
</line>
</choices-outline>
<choice id="default" title="VPN.ht" versStr="${VERSION}"/>
<choice id="${IDENTIFIER}" title="VPN.ht" visible="false">
<pkg-ref id="${IDENTIFIER}.base.pkg"/>
</choice>
<pkg-ref id="${IDENTIFIER}.base.pkg" version="${VERSION}" onConclusion="none" installKBytes="${INSTALL_KB_SIZE}">#base.pkg</pkg-ref>
</installer-gui-script>
EOF

PKG_LOCATION="${ROOTDIR}/dist/${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
( cd ${BASE_DIR}/darwin/scripts && find . | cpio -o --format odc --owner 0:80 | gzip -c ) > ${BASE_DIR}/darwin/flat/base.pkg/Scripts
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}"

0 comments on commit 4389bee

Please sign in to comment.