summaryrefslogtreecommitdiff
path: root/branding
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2019-09-04 22:12:44 +0200
committerKali Kaneko (leap communications) <kali@leap.se>2019-09-04 22:12:44 +0200
commit999cea13c1fce89350914592263a2c941c340953 (patch)
tree7a58d3e2a571744ca3bfda7dca14a2c889c70349 /branding
parent9b1d67ada0264aada7f322f44e181eb80ac5dce7 (diff)
[pkg] fix osx flat package
Diffstat (limited to 'branding')
-rw-r--r--branding/assets/riseup/osx-background.pngbin0 -> 278046 bytes
-rwxr-xr-xbranding/templates/makefile/Makefile10
-rwxr-xr-xbranding/templates/osx/cross-quickpkg136
3 files changed, 137 insertions, 9 deletions
diff --git a/branding/assets/riseup/osx-background.png b/branding/assets/riseup/osx-background.png
new file mode 100644
index 0000000..0e6cbf6
--- /dev/null
+++ b/branding/assets/riseup/osx-background.png
Binary files differ
diff --git a/branding/templates/makefile/Makefile b/branding/templates/makefile/Makefile
index 1ea4e69..164e53c 100755
--- a/branding/templates/makefile/Makefile
+++ b/branding/templates/makefile/Makefile
@@ -64,15 +64,7 @@ ifeq ($(SYSTEM), Darwin)
productsign --sign $(OSX_CERT) dist/$(APPNAME)-$(VERSION)_unsigned.pkg dist/$(APPNAME)-$(VERSION).pkg;\
fi
else
- mkdir dist/tmp
- mv dist/$(APPNAME).app dist/tmp
- mkbom -u 0 -g 80 dist/tmp dist/$(APPNAME)/Bom
- mv dist/tmp/$(APPNAME).app dist
- rmdir dist/tmp
-
- cd dist && find $(APPNAME).app | cpio -o --format odc --owner 0:80 | gzip -c > $(APPNAME)/Payload
- cd osx/scripts && find . | cpio -o --format odc --owner 0:80 | gzip -c > ../../dist/$(APPNAME)/Scripts
- xar --compression none -cf dist/$(APPNAME)-$(VERSION)_unsigned.pkg dist/$(APPNAME)/
+ cd osx && APPNAME=$(APPNAME) VERSION=$(VERSION) ./cross-quickpkg
endif
mv dist/$(APPNAME)-$(VERSION)_unsigned.pkg ../../deploy/
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 <<EOF > ${BASE_DIR}/darwin/flat/Resources/en.lproj/welcome.html
+<html>
+<body>
+<font face="helvetica">
+<h1>${APPNAME} installer</h1>
+This will guide you through the steps needed to install ${APPNAME} in your computer.
+
+<hr/>
+
+<p>
+<b>${APPNAME}</b> is a <i>simple, fast and secure VPN</i> developed by the Bitmask team. This app is configured to connect to a single trusted VPN provider.
+</p>
+
+<hr/>
+<p>The service is expensive to run. Please donate at <a href="https://riseup.net/vpn/donate">https://riseup.net/vpn/donate</a></p>
+
+</font>
+</body>
+</html>
+EOF
+
+}
+
+writePackageInfo () {
+ 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 (14B25)" auth="root">
+ <payload numberOfFiles="${NUM_FILES}" installKBytes="${INSTALL_KB_SIZE}"/>
+ <bundle-version>
+ <bundle id="${IDENTIFIER}" CFBundleIdentifier="${IDENTIFIER}" path="./Applications/${APPNAME}.app" CFBundleVersion="1.3.0"/>
+ </bundle-version>
+ <update-bundle/>
+ <atomic-update-bundle/>
+ <strict-identifier/>
+ <relocate/>
+ <scripts>
+ <preinstall file="preinstall"/>
+ <postinstall file="postinstall"/>
+ </scripts>
+</pkg-info>
+EOF
+}
+
+writeDistribution () {
+ cat <<EOF > ${BASE_DIR}/darwin/flat/Distribution
+<?xml version="1.0" encoding="utf-8"?>
+<installer-gui-script minSpecVersion="1">
+ <title>${APPNAME} ${VERSION}</title>
+ <options customize="never" allow-external-scripts="no"/>
+ <domains enable_anywhere="true"/>
+ <background file="background.png" mime-type="image/png" scaling="tofit" />
+ <background-darkAqua file="background.png" mime-type="image/png" scaling="tofit" />
+ <welcome file="welcome.html" mime-type="text/html"/>
+ <installation-check script="pm_install_check();"/>
+ <script>function pm_install_check() {
+ if(!(system.compareVersions(system.version.ProductVersion,'10.5') >= 0)) {
+ my.result.title = "Failure";
+ my.result.message = "You need at least Mac OS X 10.5 to install ${APPNAME}.";
+ my.result.type = "Fatal";
+ return false;
+ }
+ return true;
+ }
+ </script>
+ <choices-outline>
+ <line choice="choice1"/>
+ </choices-outline>
+ <choice id="choice1" title="base">
+ <pkg-ref id="${IDENTIFIER}.base.pkg"/>
+ </choice>
+ <pkg-ref id="${IDENTIFIER}.base.pkg" installKBytes="${INSTALL_KB_SIZE}" version="${VERSION}" auth="Root">#base.pkg</pkg-ref>
+</installer-gui-script>
+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