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 --- Makefile | 5 +- branding/assets/riseup/osx-background.png | Bin 0 -> 278046 bytes branding/templates/makefile/Makefile | 10 +-- branding/templates/osx/cross-quickpkg | 136 ++++++++++++++++++++++++++++++ 4 files changed, 139 insertions(+), 12 deletions(-) create mode 100644 branding/assets/riseup/osx-background.png create mode 100755 branding/templates/osx/cross-quickpkg diff --git a/Makefile b/Makefile index f1df601..0023324 100644 --- a/Makefile +++ b/Makefile @@ -7,12 +7,12 @@ TAGS ?= gtk_3_18 +XBUILD ?= no +SKIP_CACHECK ?= no PROVIDER ?= $(shell grep ^'provider =' branding/config/vendor.conf | cut -d '=' -f 2 | tr -d "[:space:]") PROVIDER_CONFIG ?= branding/config/vendor.conf DEFAULT_PROVIDER = branding/assets/default/ VERSION ?= $(shell git describe) -XBUILD ?= no -SKIP_CACHECK ?= no # go paths GOPATH = $(shell go env GOPATH) @@ -40,7 +40,6 @@ install_go: @sudo apt-get update @sudo apt-get install golang-go - depends: -@make depends$(UNAME) @go get -u golang.org/x/text/cmd/gotext github.com/cratonica/2goarray diff --git a/branding/assets/riseup/osx-background.png b/branding/assets/riseup/osx-background.png new file mode 100644 index 0000000..0e6cbf6 Binary files /dev/null and b/branding/assets/riseup/osx-background.png 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 < ${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