From 999cea13c1fce89350914592263a2c941c340953 Mon Sep 17 00:00:00 2001 From: "Kali Kaneko (leap communications)" Date: Wed, 4 Sep 2019 22:12:44 +0200 Subject: [pkg] fix osx flat package --- branding/templates/osx/cross-quickpkg | 136 ++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100755 branding/templates/osx/cross-quickpkg (limited to 'branding/templates/osx') diff --git a/branding/templates/osx/cross-quickpkg b/branding/templates/osx/cross-quickpkg new file mode 100755 index 0000000..a940889 --- /dev/null +++ b/branding/templates/osx/cross-quickpkg @@ -0,0 +1,136 @@ +#!/bin/bash +# --------------------------------------------------------- +# Creates a OSX flat installer package from a Linux +# environment. You need xar and bomutils in your $PATH +# --------------------------------------------------------- +# +# kudos to SchizoDuckie for putting this gist together +# +# https://gist.github.com/SchizoDuckie/2a1a1cc71284e6463b9a +# https://krypted.com/mac-os-x/inspecting-creating-mac-installer-packages-linux/ +# ---------------------------------------------------------- + + +# The following variables need to be overriden by environment vars + +: "${VERSION:=0.0.1}" +: "${APPNAME:=TestApp}" +: "${IDENTIFIER:=se.leap.bitmask.installer}" + +# ---------------------------------------------------------- + +BUILD_DIR="../dist" +BASE_DIR="../build/osx" +BACKGROUND="../assets/osx-background.png" + +# ---------------------------------------------------------- + +initialize () { + 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" + mkdir -p "$BASE_DIR/darwin/scripts" + cp -R $BUILD_DIR/*.app $BASE_DIR/darwin/root/Applications + cp -R scripts/* $BASE_DIR/darwin/scripts/ + cp $BACKGROUND $BASE_DIR/darwin/flat/Resources/en.lproj/background.png + NUM_FILES=$(find ${BASE_DIR}/darwin/root | wc -l) + INSTALL_KB_SIZE=$(du -k -s ${BASE_DIR}/darwin/root | awk "{print $1}") +} + +# TODO for localization, these files should be taken from transifex, etc. +# TODO hardcoding a foundation for now. +writeInstallerDocs () { + cat < ${BASE_DIR}/darwin/flat/Resources/en.lproj/welcome.html + + + +

${APPNAME} installer

+This will guide you through the steps needed to install ${APPNAME} in your computer. + +
+ +

+${APPNAME} is a simple, fast and secure VPN developed by the Bitmask team. This app is configured to connect to a single trusted VPN provider. +

+ +
+

The service is expensive to run. Please donate at https://riseup.net/vpn/donate

+ +
+ + +EOF + +} + +writePackageInfo () { + cat < ${BASE_DIR}/darwin/flat/base.pkg/PackageInfo + + + + + + + + + + + + + + + +EOF +} + +writeDistribution () { + cat < ${BASE_DIR}/darwin/flat/Distribution + + + ${APPNAME} ${VERSION} + + + + + + + + + + + + + + #base.pkg + +EOF +} + +createPackage () { + PKG_NAME="${APPNAME}-${VERSION}_unsigned.pkg" + PKG_LOCATION="../../${PKG_NAME}" + PKG_LOCATION_REL="${BASE_DIR}/${PKG_NAME}" + PKG_FINAL="${BUILD_DIR}/${PKG_NAME}" + ( 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}" * ) + cp ${PKG_LOCATION_REL} ${PKG_FINAL} + echo "[+] OSX package has been built: ${PKG_FINAL}" +} + +initialize +writeInstallerDocs +writePackageInfo +writeDistribution +createPackage -- cgit v1.2.3