Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • m1ghtfr3e/bitmask-vpn
  • leap/bitmask-vpn
  • meskio/bitmask-vpn
  • kali/bitmask-vpn
  • nsheep/bitmask-vpn
  • nilesh/bitmask-vpn
  • micah/bitmask-vpn
  • kwadronaut/bitmask-vpn
  • th/bitmask-vpn
  • wxl/bitmask-vpn
  • Nowa-Ammerlaan/bitmask-vpn
  • elijah/bitmask-vpn
  • happysalada/bitmask-vpn
  • JUZZZEE/bitmask-vpn
  • jkito/bitmask-vpn
  • panetone/bitmask-vpn
  • hsilva/bitmask-vpn
  • S0b0tkaZ11gy/bitmask-vpn
  • polster/bitmask-vpn-pahoeohe
  • Kulibin/bitmask-vpn
  • TheMimoGz/bitmask-vpn
  • fifi/bitmask-vpn
  • fly/bitmask-vpn
  • VlKozlove/bitmask-vpn
  • DonMephedrone/bitmask-vpn
  • Arti/bitmask-vpn
  • annxxxxx/bitmask-vpn
  • Arti/arti-bitmask-vpn-fork
  • peanut2/bitmask-vpn
29 results
Show changes
Showing
with 377 additions and 1005 deletions
#!/usr/bin/env python3
import sys
arg = sys.argv[1]
line = [x for x in arg.split('\n') if x.startswith('Status:')]
print(line[0].split('=')[1])
#!/bin/bash
# Notes to script notarization steps.
# To be called from the root folder.
# Taken from https://oozou.com/blog/scripting-notarization-for-macos-app-distribution-38
# TODO: put pass in keychain
# --password "@keychain:notarization-password"
USER=info@leap.se
requestInfo=$(xcrun altool --notarize-app \
-t osx -f build/installer/${APPNAME}-installer-${VERSION}.zip \
--primary-bundle-id="se.leap.bitmask.${TARGET}" \
-u ${USER} \
-p ${OSXAPPPASS})
uuid=$(python3 branding/scripts/osx-staple-uuid.py $requestInfo)
current_status="in progress"
while [[ "$currentStatus" == "in progress" ]]; do
sleep 15
statusResponse=$(xcrun altool --notarization-info "$uuid" \
--username ${USER} \
--password ${OSXAPPPASS})
current_status=$(python3 branding/scripts/osx-staple-status.py $statusResponse)
done
if [[ "$current_status" == "success" ]]; then
# staple notarization here
xcrun stapler staple build/installer/${APPNAME}-installer-${VERSION}.app
create-dmg deploy/${APPNAME}-${VERSION}.dmg build/installer/${APPNAME}-installer-${VERSION}.app
else
echo "Error! The status was $current_status. There were errors. Please check the LogFileURL for error descriptions"
exit 1
fi
......@@ -2,32 +2,51 @@ import datetime
import os
def getDefaultProvider(config):
def getDefaultProviders(config):
# returns a list of providers
provider = os.environ.get('PROVIDER')
if provider:
print('[+] Got provider {} from environment'.format(provider))
else:
print('[+] Using default provider from config file')
provider = config['default']['provider']
return provider
return provider.split(',')
def getProviderData(provider, config):
print("[+] Configured provider:", provider)
try:
c = config[provider]
except Exception:
raise ValueError('Cannot find provider')
c = config[provider]
d = dict()
keys = ('name', 'applicationName', 'binaryName', 'auth',
keys = ('name', 'applicationName', 'binaryName', 'auth', 'authEmptyPass',
'providerURL', 'tosURL', 'helpURL',
'askForDonations', 'donateURL', 'apiURL',
'geolocationAPI', 'caCertString')
'apiVersion', 'geolocationAPI', 'caCertString',
'STUNServers', 'countryCodeLookupURL')
boolValues = ['askForDonations', 'authEmptyPass']
intValues = ['apiVersion', ]
listValues = ['STUNServers']
for value in keys:
if value not in c:
continue
d[value] = c.get(value)
if value in boolValues:
d[value] = bool(d[value])
elif value in intValues:
d[value] = int(d[value])
elif value in listValues:
if d[value].strip() == "":
d[value] = []
else:
d[value] = d[value].split(",")
# remove spaces
d[value] = [x.strip() for x in d[value]]
d['timeStamp'] = '{:%Y-%m-%d %H:%M:%S}'.format(
datetime.datetime.now())
return d
#!/usr/bin/env python3
# TODO: to be deprecated! use gen-providers-json.py instead
import os
import sys
from string import Template
import configparser
from provider import getDefaultProvider
from provider import getProviderData
OUTFILE = 'config.go'
INFILE = '../templates/bitmaskvpn/config.go'
CONFIGFILE = '../config/vendor.conf'
SCRIPT_NAME = 'vendorize'
def addCaData(data, configfile):
provider = data.get('name').lower()
folder, f = os.path.split(configfile)
caFile = os.path.join(folder, provider + '-ca.crt')
if not os.path.isfile(caFile):
bail('[!] Cannot find CA file in {path}'.format(path=caFile))
with open(caFile) as ca:
data['caCertString'] = ca.read().strip()
def writeOutput(data, infile, outfile):
with open(infile) as infile:
s = Template(infile.read())
with open(outfile, 'w') as outf:
outf.write(s.substitute(data))
def bail(msg=None):
if not msg:
print('Usage: {scriptname}.py <template> <config> <output>'.format(
scriptname=SCRIPT_NAME))
else:
print(msg)
sys.exit(1)
if __name__ == "__main__":
infile = outfile = ""
if len(sys.argv) > 4:
bail()
elif len(sys.argv) == 1:
infile = INFILE
outfile = OUTFILE
configfile = CONFIGFILE
else:
try:
infile = sys.argv[1]
configfile = sys.argv[2]
outfile = sys.argv[3]
except IndexError:
bail()
env_provider_conf = os.environ.get('PROVIDER_CONFIG')
if env_provider_conf:
if os.path.isfile(env_provider_conf):
print("[+] Overriding provider config per "
"PROVIDER_CONFIG variable")
configfile = env_provider_conf
if not os.path.isfile(infile):
bail('[!] Cannot find template in {path}'.format(
path=os.path.abspath(infile)))
elif not os.path.isfile(configfile):
bail('[!] Cannot find config in {path}'.format(
path=os.path.abspath(configfile)))
else:
print('[+] Using {path} as template'.format(
path=os.path.abspath(infile)))
print('[+] Using {path} as config'.format(
path=os.path.abspath(configfile)))
config = configparser.ConfigParser()
config.read(configfile)
provider = getDefaultProvider(config)
data = getProviderData(provider, config)
addCaData(data, configfile)
writeOutput(data, infile, outfile)
print('[+] Wrote configuration for {provider} to {outf}'.format(
provider=data.get('name'),
outf=os.path.abspath(outfile)))
// Code generated by go generate; DO NOT EDIT.
// This file was generated by vendorize.py
// At $timeStamp
package config
/* All these constants are defined in the vendor.conf file
*/
const (
Provider = "$providerURL"
ApplicationName = "$applicationName"
BinaryName = "$binaryName"
Auth = "$auth"
DonateURL = "$donateURL"
AskForDonations = "$askForDonations"
HelpURL = "$helpURL"
TosURL = "$tosURL"
APIURL = "$apiURL"
GeolocationAPI = "$geolocationAPI"
)
var Version string
/*
CaCert : a string containing a representation of the provider CA, used to
sign the webapp and openvpn certificates. should be placed in
config/[provider]-ca.crt
*/
var CaCert = []byte(`$caCertString`)
......@@ -7,7 +7,7 @@ Comment[es]=VPN Facil de ${name}
Comment[de]=Easy VPN by ${name}
Exec=${binaryName} %U
Terminal=false
Icon=icon
Icon=${binaryName}
Categories=Network;Application;
StartupNotify=true
X-AppInstall-Package=${binaryName}
......
debian/${binaryName}.desktop usr/share/applications
debian/icons/scalable/${binaryName}.png usr/share/icons/hicolor/256x256/apps
${binaryName} (${version}) unstable; urgency=medium
* Initial package.
* Reduces the size of splash screen image
* Disable obfs4 and kcp checkbox in preferences for riseup
* Removes duplicate languages in the language picker in preferences
* Language picker in preferences shows languages sorted alphabetically
* Updates translation files
* Adds region to language selections menu when available
* Improves UI responsiveness when connect or disconnect fails
* Disable automatic openvpn connection during app start
* Fixes a local privilege escalation security bug when using "--install-helpers"
* Change bitmask branded app name to Bitmask from BitmaskVPN
* Fixes bug where MOTD message box was not shown for RiseupVPN
* Show bridge icon when KCP transport is selected
* Show license page during installation
* Uninstalls previous version before installing current version
* Adds accessibility hints to connection button
* Exposes KCP support in the UI
* Adds new bitmask-vpn package for Arch Linux
* Fixes a bug preventing use of the app by non-admin users on windows
* Fixes a bug on macOS preventing users from manual location selection
* Fixes a bug where the app's close routine was called twice
* Fixes a bug where log file was not closed while quitting the app
* Fixes a bug where the correct app name was not shown in installer error messages
* Updates to latest obfsvpn
* Updates to latest bitmask-core
* Updates translation files
* Adds missing iptables dependency to ubuntu package
-- LEAP Encryption Access Project <debian@leap.se> Mon, 29 Jul 2019 10:00:00 +0100
-- LEAP Encryption Access Project <debian@leap.se> Fri, 04 Oct 2024 09:16:36 +0200
riseup-vpn (0.24.5-3-geb2df9a~noble) noble; urgency=medium
* fixes missing dependencies on .deb package
* Shorten too long strings in translations
* Connection status text width trimmed to be inside parent container
* Update GUI to Qt6
* Fixes a bug where after using obfs4 it was impossible to gracefully close the app
-- LEAP Encryption Access Project <debian@leap.se> Sun, 19 May 2024 11:54:54 +0530
10
Source: ${binaryName}
Section: net
Priority: extra
Priority: optional
Maintainer: LEAP Encryption Access Project <debian@leap.se>
Build-Depends: debhelper (>= 10.0.0), dh-golang, golang-go (> 2:1.9),
golang-golang-x-text-dev (>= 0.3.0-2),
libgtk-3-dev, libappindicator3-dev, pkg-config
Standards-Version: 3.9.8
Build-Depends: debhelper-compat (= 12), golang (>= 1.22), make (>=3.80), pkg-config, g++ (>= 4:4.6.3), git,
libqt6svg6-dev, qt6-tools-dev, qt6-tools-dev-tools, qt6-base-dev, libqt6qml6, qt6-declarative-dev,
dh-golang, libgl-dev, qt6-declarative-dev-tools, qt6-l10n-tools, python3
Standards-Version: 4.4.1
Homepage: https://0xacab.org/leap/bitmask-vpn
Package: ${binaryName}
Architecture: any
Multi-Arch: foreign
Depends: ${misc:Depends},
openvpn, libgtk-3-0, libappindicator3-1,
policykit-1-gnome | polkit-1-auth-agent,
python3,
Enhances: openvpn
Depends: ${misc:Depends}, ${shlibs:Depends}, libqt6core6, libqt6gui6, libqt6qml6, libqt6widgets6, libstdc++6,
libqt6svg6, qml6-module-qtquick, qml6-module-qtquick-controls, qml6-module-qtquick-dialogs,
qml6-module-qtquick-layouts, qml6-module-qtqml-workerscript, qml6-module-qtquick-templates, qml6-module-qt-labs-settings,
qml6-module-qtquick-window, qml6-module-qt-labs-platform, qml6-module-qtcore, qml6-module-qt5compat-graphicaleffects,
openvpn, policykit-1-gnome | polkit-1-auth-agent, python3, iptables
Description: Easy, fast, and secure VPN service from ${name}.
This package is a custom build of the new Bitmask VPN client, preconfigured
to use the ${providerURL} provider.
.
The service does not require a user account, keep logs, or track you in any
way. The service is paid for entirely by donations from users.
......@@ -4,7 +4,7 @@ Source: <https://0xacab.org/leap/riseup_vpn>
Files: *
Copyright: 2018 LEAP Encryption Access Project <info@leap.se>
License: GPLv3
License: GPL
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
......
......@@ -10,7 +10,7 @@ import os
from string import Template
TEMPLATES = ('app.desktop', 'changelog', 'control', 'rules')
TEMPLATES = ('app.install', 'app.desktop', 'changelog', 'control', 'rules', 'source/include-binaries')
here = os.path.split(os.path.realpath(__file__))[0]
......
From 82e3eda5709f1f8dd6bdb898a3c6b71a41cc4e62 Mon Sep 17 00:00:00 2001
From: jkito <belter@riseup.net>
Date: Sun, 25 Aug 2024 17:18:10 +0530
Subject: [PATCH] build: use qt5compat qml module to build on qt6.4 for ubuntu
and debian
---
bitmask.pro | 2 +-
gui/components/ErrorBox.qml | 2 +-
gui/components/Footer.qml | 14 ++++++--------
gui/components/Home.qml | 2 +-
gui/components/InitErrors.qml | 2 +-
gui/components/Locations.qml | 7 +++----
gui/components/MotdBox.qml | 2 +-
gui/components/Preferences.qml | 4 ++--
gui/components/SignalIcon.qml | 7 +++----
gui/components/Splash.qml | 2 +-
gui/components/StatusBox.qml | 2 +-
11 files changed, 21 insertions(+), 25 deletions(-)
diff --git a/bitmask.pro b/bitmask.pro
index bbeacb12..58ba5f2f 100644
--- a/bitmask.pro
+++ b/bitmask.pro
@@ -1,8 +1,8 @@
TARGET = $$TARGET
QT += quickcontrols2 svg
-CONFIG += qt staticlib
CONFIG += c++17 strict_c++
+CONFIG += qt staticlib core5compat
CONFIG += qtquickcompiler
RELEASE = $$RELEASE
diff --git a/gui/components/ErrorBox.qml b/gui/components/ErrorBox.qml
index 5667ed9d..ef8f58fb 100644
--- a/gui/components/ErrorBox.qml
+++ b/gui/components/ErrorBox.qml
@@ -1,6 +1,6 @@
import QtQuick
import QtQuick.Controls
-import QtQuick.Effects
+import Qt5Compat.GraphicalEffects
import "../themes/themes.js" as Theme
Item {
diff --git a/gui/components/Footer.qml b/gui/components/Footer.qml
index d534f96a..9df6db62 100644
--- a/gui/components/Footer.qml
+++ b/gui/components/Footer.qml
@@ -2,7 +2,7 @@ import QtQuick
import QtQuick.Controls
import QtQuick.Controls.Material
import QtQuick.Layouts
-import QtQuick.Effects
+import Qt5Compat.GraphicalEffects
import "../themes/themes.js" as Theme
ToolBar {
@@ -49,7 +49,7 @@ ToolBar {
}
Image {
- id: lightning
+ id: lightning
smooth: true
visible: ctx != undefined & root.selectedGateway == "auto"
width: 16
@@ -61,11 +61,10 @@ ToolBar {
verticalCenter: gwButton.verticalCenter
}
}
- MultiEffect {
+ ColorOverlay{
anchors.fill: lightning
source: lightning
- colorizationColor: getLocationColor()
- colorization: 1.0
+ color: getLocationColor()
antialiasing: true
}
@@ -123,11 +122,10 @@ ToolBar {
rightMargin: 20
}
}
- MultiEffect {
+ ColorOverlay{
anchors.fill: gwQuality
source: gwQuality
- colorizationColor: getSignalColor()
- colorization: 1.0
+ color: getSignalColor()
antialiasing: false
}
}
diff --git a/gui/components/Home.qml b/gui/components/Home.qml
index f3bea85a..7830f46d 100644
--- a/gui/components/Home.qml
+++ b/gui/components/Home.qml
@@ -1,6 +1,6 @@
import QtQuick
import QtQuick.Controls
-import QtQuick.Effects
+import Qt5Compat.GraphicalEffects
Page {
StatusBox {
diff --git a/gui/components/InitErrors.qml b/gui/components/InitErrors.qml
index aaf9897b..10b4755c 100644
--- a/gui/components/InitErrors.qml
+++ b/gui/components/InitErrors.qml
@@ -1,6 +1,6 @@
import QtQuick
import QtQuick.Controls
-import QtQuick.Effects
+import Qt5Compat.GraphicalEffects
ErrorBox {
diff --git a/gui/components/Locations.qml b/gui/components/Locations.qml
index 2a188738..6228a58c 100644
--- a/gui/components/Locations.qml
+++ b/gui/components/Locations.qml
@@ -1,7 +1,7 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
-import QtQuick.Effects
+import Qt5Compat.GraphicalEffects
import "../themes/themes.js" as Theme
@@ -81,11 +81,10 @@ ThemedPage {
//verticalCenterOffset: 3
}
}
- MultiEffect {
+ ColorOverlay{
anchors.fill: lightning
source: lightning
- colorizationColor: "black"
- colorization: 1.0
+ color: "black"
antialiasing: true
}
}
diff --git a/gui/components/MotdBox.qml b/gui/components/MotdBox.qml
index 2c8cdb8b..7b851c0c 100644
--- a/gui/components/MotdBox.qml
+++ b/gui/components/MotdBox.qml
@@ -1,6 +1,6 @@
import QtQuick
import QtQuick.Controls
-import QtQuick.Effects
+import Qt5Compat.GraphicalEffects
import "../themes/themes.js" as Theme
Item {
diff --git a/gui/components/Preferences.qml b/gui/components/Preferences.qml
index d8ed6587..a0b6bba6 100644
--- a/gui/components/Preferences.qml
+++ b/gui/components/Preferences.qml
@@ -2,8 +2,8 @@ import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Controls.Material
-import QtQuick.Effects
-import QtCore
+import Qt5Compat.GraphicalEffects
+import Qt.labs.settings
import "../themes/themes.js" as Theme
diff --git a/gui/components/SignalIcon.qml b/gui/components/SignalIcon.qml
index 8747f054..38a23710 100644
--- a/gui/components/SignalIcon.qml
+++ b/gui/components/SignalIcon.qml
@@ -1,7 +1,7 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
-import QtQuick.Effects
+import Qt5Compat.GraphicalEffects
import "../themes/themes.js" as Theme
@@ -41,11 +41,10 @@ Item {
]
}
}
- MultiEffect {
+ ColorOverlay{
anchors.fill: icon
source: icon
- colorizationColor: getQualityColor()
- colorization: 1.0
+ color: getQualityColor()
antialiasing: true
}
diff --git a/gui/components/Splash.qml b/gui/components/Splash.qml
index c9351804..d18cc3ba 100644
--- a/gui/components/Splash.qml
+++ b/gui/components/Splash.qml
@@ -1,6 +1,6 @@
import QtQuick
import QtQuick.Controls
-import QtQuick.Effects
+import Qt5Compat.GraphicalEffects
import "../themes/themes.js" as Theme
Page {
diff --git a/gui/components/StatusBox.qml b/gui/components/StatusBox.qml
index d17c2fe0..24a1f8f2 100644
--- a/gui/components/StatusBox.qml
+++ b/gui/components/StatusBox.qml
@@ -1,6 +1,6 @@
import QtQuick
import QtQuick.Controls
-import QtQuick.Effects
+import Qt5Compat.GraphicalEffects
import QtQuick.Layouts
import QtQuick.Templates as T
import QtQuick.Controls.impl
--
2.46.0
0001-build-use-qt5compat-qml-module-to-build-on-qt6.4-for.patch
......@@ -9,6 +9,11 @@ export GOCACHE=/tmp/gocache
export DH_GOPKG = 0xacab.org/leap/bitmask-vpn
export DH_GOLANG_EXCLUDES := vendor packages tools cmd/bitmask-helper cmd/bitmask-connect
export PATH := $(shell qmake6 -query "QT_INSTALL_BINS"):$(PATH)
export PROVIDER=${name}
export VENDOR_PATH=providers
#dh_golang doesn't do this for you
ifeq ($(DEB_HOST_ARCH), i386)
......@@ -32,20 +37,18 @@ APPNAME = ${binaryName}
override_dh_auto_test:
override_dh_auto_build:
mkdir -p /tmp/gocache
rm -rf src/0xacab.org/leap/bitmask-vpn/tools/transifex
rm -rf obj-$(DEB_BUILD_GNU_TYPE)/src/0xacab.org/leap/bitmask-vpn/tools/transifex
rm -rf tools
dh_auto_build -O--buildsystem=golang -- -ldflags "-X main.version=$(VERSION)"
make gen_providers_json
make build
override_dh_install:
mkdir -p $(CURDIR)/debian/${APPNAME}/usr/bin
mkdir -p $(CURDIR)/debian/${APPNAME}/usr/sbin
cp $(CURDIR)/helpers/bitmask-root $(CURDIR)/debian/${binaryName}/usr/sbin/
cp $(CURDIR)/pkg/pickle/helpers/bitmask-root $(CURDIR)/debian/${APPNAME}/usr/sbin/
mkdir -p $(CURDIR)/debian/${APPNAME}/usr/share/polkit-1/actions
cp $(CURDIR)/helpers/se.leap.bitmask.policy $(CURDIR)/debian/${APPNAME}/usr/share/polkit-1/actions
rm -fr $(CURDIR)/debian/${APPNAME}/usr/share/gocode
strip $(CURDIR)/debian/${APPNAME}/usr/bin/bitmask-vpn
mv $(CURDIR)/debian/${APPNAME}/usr/bin/bitmask-vpn $(CURDIR)/debian/${APPNAME}/usr/bin/${APPNAME}
mkdir -p $(CURDIR)/debian/${APPNAME}/usr/share/${APPNAME}
cp $(CURDIR)/debian/icons/scalable/icon.svg $(CURDIR)/debian/${APPNAME}/usr/share/${APPNAME}/icon.svg
cp $(CURDIR)/helpers/se.leap.bitmask.policy $(CURDIR)/debian/${APPNAME}/usr/share/polkit-1/actions
cp build/qt/release/${APPNAME} $(CURDIR)/debian/${APPNAME}/usr/bin/${APPNAME}
strip $(CURDIR)/debian/${APPNAME}/usr/bin/${APPNAME}
dh_install
override_dh_dwz:
echo "skipping dh_dwz"
debian/icons/scalable/${binaryName}.png
......@@ -15,7 +15,7 @@ BUILD_RELEASE?=no
WIN_CERT_PATH?=z:\leap\LEAP.pfx
WIN_CERT_PASS?=
OSX_CERT = "Developer ID Installer: LEAP Encryption Access Project"
DEB_VERSION = $(shell echo ${VERSION} | cut -d '-' -f 1,2)
DEB_VERSION = $(shell echo ${VERSION} | rev | cut -d '-' -f2- | rev)
ifeq ($(OS),Windows_NT) # is Windows_NT on XP, 2000, 7, Vista, 10...
SYSTEM = Windows
......@@ -85,11 +85,13 @@ endif
pkg_snap:
-@mkdir -p ../../deploy
@echo "[+] building snap..."
snapcraft build
cd ../..; \
snapcraft build; \
snapcraft snap
@mv $(BINNAME)* ../../deploy
-@rm ../../snap
@mv ../../$(BINNAME)* ../../deploy
pkg_deb:
prepare_deb:
echo "[+] building debian package version" ${DEB_VERSION}
-@mkdir -p ../../deploy
@if [ $(BUILD_RELEASE) = no ]; then\
......@@ -104,6 +106,8 @@ pkg_deb:
@rm -rf build/${BINNAME}_${DEB_VERSION} build/bitmask-vpn_${VERSION}-src
@cd build && tar xzf $(BINNAME)_${DEB_VERSION}.orig.tar.gz && mv bitmask-vpn_${VERSION}-src ${BINNAME}_${DEB_VERSION}
@cp -r debian/ build/$(BINNAME)_$(DEB_VERSION)/
pkg_deb: prepare_deb
@cd build/$(BINNAME)_$(DEB_VERSION) && debuild -us -uc
@mv build/*.deb ../../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
#!/usr/bin/python
# Generate bundles for brandable Bitmask Lite.
# (c) LEAP Encryption Access Project
# (c) Kali Kaneko 2018-2019
import json
import os
import os.path
import shutil
import stat
import sys
from string import Template
here = os.path.split(os.path.abspath(__file__))[0]
ENTRYPOINT = 'bitmask-vpn'
TEMPLATE_INFO = 'template-info.plist'
TEMPLATE_HELPER = 'template-helper.plist'
TEMPLATE_PACKAGEINFO = 'template-packageinfo.plist'
TEMPLATE_PREINSTALL = 'template-preinstall'
TEMPLATE_POSTINSTALL = 'template-postinstall'
data = json.load(open(os.path.join(here, 'data.json')))
APPNAME = data.get('applicationName')
VERSION = data.get('version', 'unknown')
APP_PATH = os.path.abspath(here + '/../dist/' + APPNAME + ".app")
PKG_PATH = os.path.abspath(here + '/../dist/' + APPNAME)
STAGING = os.path.abspath(here + '/../staging/')
ASSETS = os.path.abspath(here + '/../assets/')
ICON = os.path.join(ASSETS, 'icon.icns')
SCRIPTS = os.path.join(os.path.abspath(here), 'scripts')
INFO_PLIST = APP_PATH + '/Contents/Info.plist'
HELPER_PLIST = os.path.join(SCRIPTS, 'se.leap.bitmask-helper.plist')
PACKAGEINFO = os.path.join(PKG_PATH, 'PackageInfo')
PREINSTALL = os.path.join(SCRIPTS, 'preinstall')
POSTINSTALL = os.path.join(SCRIPTS, 'postinstall')
RULEFILE = os.path.join(here, 'bitmask.pf.conf')
VPN_UP = os.path.join(here, 'client.up.sh')
VPN_DOWN = os.path.join(here, 'client.down.sh')
try:
os.makedirs(APP_PATH + "/Contents/MacOS")
except Exception:
pass
try:
os.makedirs(APP_PATH + "/Contents/Resources")
except Exception:
pass
try:
os.makedirs(APP_PATH + "/Contents/helper")
except Exception:
pass
data['entrypoint'] = ENTRYPOINT
data['info_string'] = APPNAME + " " + VERSION
data['bundle_identifier'] = 'se.leap.' + data['applicationNameLower']
data['bundle_name'] = APPNAME
# utils
def generate_from_template(template, dest, data):
print("[+] File written from template to", dest)
template = Template(open(template).read())
with open(dest, 'w') as output:
output.write(template.substitute(data))
# 1. Generation of the Bundle Info.plist
# --------------------------------------
generate_from_template(TEMPLATE_INFO, INFO_PLIST, data)
# 2. Generate PkgInfo
# -------------------------------------------
with open(APP_PATH + "/Contents/PkgInfo", "w") as f:
# is this enough? See what PyInstaller does.
f.write("APPL????")
# 3. Generate if needed the package info (for cross build)
# --------------------------------------------
if not sys.platform.startswith('darwin'):
try:
os.mkdir(PKG_PATH)
except FileExistsError:
pass
generate_from_template(TEMPLATE_PACKAGEINFO, PACKAGEINFO, data)
# 4. Copy the app icon from the assets folder
# -----------------------------------------------
shutil.copyfile(ICON, APP_PATH + '/Contents/Resources/app.icns')
# 5. Generate the scripts for the installer
# -----------------------------------------------
# Watch out that, for now, all the brandings are sharing the same helper name.
# This is intentional: I prefer not to have too many root helpers laying around
# until we consolidate a way of uninstalling and/or updating them.
# This also means that only one of the derivatives will work at a given time
# (ie, uninstall bitmask legacy to use riseupvpn).
# If this bothers you, and it should, let's work on improving uninstall and
# updates.
generate_from_template(TEMPLATE_HELPER, HELPER_PLIST, data)
generate_from_template(TEMPLATE_PREINSTALL, PREINSTALL, data)
generate_from_template(TEMPLATE_POSTINSTALL, POSTINSTALL, data)
# 6. Copy helper pf rule file
# ------------------------------------------------
shutil.copy(RULEFILE, APP_PATH + '/Contents/helper/')
# 7. Copy openvpn up/down scripts
# ------------------------------------------------
shutil.copy(VPN_UP, APP_PATH + '/Contents/helper/')
shutil.copy(VPN_DOWN, APP_PATH + '/Contents/helper/')
# 8. Generate uninstall script
# -----------------------------------------------
# TODO copy the uninstaller script from bitmask-dev
# TODO substitute vars
# this is a bit weak procedure for now.
# To begin with, this assumes everything is hardcoded into
# /Applications/APPNAME.app
# We could consider moving the helpers into /usr/local/sbin,
# so that the plist files always reference there.
# We're all set!
# -----------------------------------------------
print("[+] Output written to build/{provider}/dist/{appname}.app".format(
provider=data['name'].lower(),
appname=APPNAME))
This diff is collapsed.