Skip to content
Snippets Groups Projects
Unverified Commit 999cea13 authored by Kali Kaneko's avatar Kali Kaneko
Browse files

[pkg] fix osx flat package

parent 9b1d67ad
No related branches found
No related tags found
No related merge requests found
...@@ -7,12 +7,12 @@ ...@@ -7,12 +7,12 @@
TAGS ?= gtk_3_18 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 ?= $(shell grep ^'provider =' branding/config/vendor.conf | cut -d '=' -f 2 | tr -d "[:space:]")
PROVIDER_CONFIG ?= branding/config/vendor.conf PROVIDER_CONFIG ?= branding/config/vendor.conf
DEFAULT_PROVIDER = branding/assets/default/ DEFAULT_PROVIDER = branding/assets/default/
VERSION ?= $(shell git describe) VERSION ?= $(shell git describe)
XBUILD ?= no
SKIP_CACHECK ?= no
# go paths # go paths
GOPATH = $(shell go env GOPATH) GOPATH = $(shell go env GOPATH)
...@@ -40,7 +40,6 @@ install_go: ...@@ -40,7 +40,6 @@ install_go:
@sudo apt-get update @sudo apt-get update
@sudo apt-get install golang-go @sudo apt-get install golang-go
depends: depends:
-@make depends$(UNAME) -@make depends$(UNAME)
@go get -u golang.org/x/text/cmd/gotext github.com/cratonica/2goarray @go get -u golang.org/x/text/cmd/gotext github.com/cratonica/2goarray
......
branding/assets/riseup/osx-background.png

272 KiB

...@@ -64,15 +64,7 @@ ifeq ($(SYSTEM), Darwin) ...@@ -64,15 +64,7 @@ ifeq ($(SYSTEM), Darwin)
productsign --sign $(OSX_CERT) dist/$(APPNAME)-$(VERSION)_unsigned.pkg dist/$(APPNAME)-$(VERSION).pkg;\ productsign --sign $(OSX_CERT) dist/$(APPNAME)-$(VERSION)_unsigned.pkg dist/$(APPNAME)-$(VERSION).pkg;\
fi fi
else else
mkdir dist/tmp cd osx && APPNAME=$(APPNAME) VERSION=$(VERSION) ./cross-quickpkg
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)/
endif endif
mv dist/$(APPNAME)-$(VERSION)_unsigned.pkg ../../deploy/ mv dist/$(APPNAME)-$(VERSION)_unsigned.pkg ../../deploy/
......
#!/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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment