From 1ae11e5c615c996cbef3db694fc571bfe6524d1d Mon Sep 17 00:00:00 2001 From: "kali kaneko (leap communications)" Date: Wed, 8 Jul 2020 20:43:12 +0200 Subject: [pkg] boilerplate for qtinstaller framework --- Makefile | 3 ++ bitmask.pro | 1 + gui/build.sh | 4 +-- gui/handlers.h | 2 -- installer/.gitignore | 4 +++ installer/bitmask-installer.pro | 21 +++++++++++ installer/config/config.xml | 12 +++++++ installer/packages/riseupvpn/data/README.txt | 1 + installer/packages/riseupvpn/meta/install.js | 51 +++++++++++++++++++++++++++ installer/packages/riseupvpn/meta/package.xml | 11 ++++++ 10 files changed, 106 insertions(+), 4 deletions(-) create mode 100644 installer/.gitignore create mode 100644 installer/bitmask-installer.pro create mode 100644 installer/config/config.xml create mode 100644 installer/packages/riseupvpn/data/README.txt create mode 100644 installer/packages/riseupvpn/meta/install.js create mode 100644 installer/packages/riseupvpn/meta/package.xml diff --git a/Makefile b/Makefile index 78f2e93..a62f2e2 100644 --- a/Makefile +++ b/Makefile @@ -58,6 +58,9 @@ dependsCygwin: @choco install -y golang python nssm nsis wget 7zip build: + gui/build.sh + +build_old: ifeq (${XBUILD}, yes) $(MAKE) build_cross_win $(MAKE) build_cross_osx diff --git a/bitmask.pro b/bitmask.pro index 3ab8507..7f4b488 100644 --- a/bitmask.pro +++ b/bitmask.pro @@ -9,6 +9,7 @@ QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.14 macx { LIBS += -framework Security + ICON = ./branding/assets/riseup/icon.icns } QT += qml quick widgets diff --git a/gui/build.sh b/gui/build.sh index 1ded17e..91be4fc 100755 --- a/gui/build.sh +++ b/gui/build.sh @@ -20,8 +20,8 @@ fi if [ "$XBUILD" == "$WIN64" ] then # TODO allow to override vars - QMAKE="`pwd`/../mxe/usr/x86_64-w64-mingw32.static/qt5/bin/qmake" - PATH="`pwd`/../mxe/usr/bin"/:$PATH + QMAKE="`pwd`/../../mxe/usr/x86_64-w64-mingw32.static/qt5/bin/qmake" + PATH="`pwd`/../../mxe/usr/bin"/:$PATH CC=x86_64-w64-mingw32.static-gcc else if [ "$QMAKE" == "" ] diff --git a/gui/handlers.h b/gui/handlers.h index d746524..c342a97 100644 --- a/gui/handlers.h +++ b/gui/handlers.h @@ -12,8 +12,6 @@ class QJsonWatch : public QObject { Q_OBJECT - QJsonModel *model; - public: signals: diff --git a/installer/.gitignore b/installer/.gitignore new file mode 100644 index 0000000..2fdd01e --- /dev/null +++ b/installer/.gitignore @@ -0,0 +1,4 @@ +.qmake.stash +Makefile +packages/riseupvpn/data/riseup-vpn +RiseupVPN-Installer diff --git a/installer/bitmask-installer.pro b/installer/bitmask-installer.pro new file mode 100644 index 0000000..c526283 --- /dev/null +++ b/installer/bitmask-installer.pro @@ -0,0 +1,21 @@ +TEMPLATE = aux + +CONFIG -= debug_and_release + +INSTALLER = RiseupVPN-Installer + +INPUT = $$PWD/config/config.xml $$PWD/packages +inst.input = INPUT +inst.output = $$INSTALLER +inst.commands = binarycreator -c $$PWD/config/config.xml -p $$PWD/packages ${QMAKE_FILE_OUT} +inst.CONFIG += target_predeps no_link combine + +QMAKE_EXTRA_COMPILERS += inst + +OTHER_FILES += \ +# watch out... it chokes with dashes in the path + packages/riseupvpn/meta/package.xml \ + packages/riseupvpn/meta/install.js \ + packages/riseupvpn/data/README.txt \ + packages/riseupvpn/data/riseup-vpn + diff --git a/installer/config/config.xml b/installer/config/config.xml new file mode 100644 index 0000000..ef0e5e8 --- /dev/null +++ b/installer/config/config.xml @@ -0,0 +1,12 @@ + + + RiseupVPN Installer 1.0 + RiseupVPN Installer + 1.0.0 + @ApplicationsDir@/RiseupVPN + + + http://localhost/repository/ + + + diff --git a/installer/packages/riseupvpn/data/README.txt b/installer/packages/riseupvpn/data/README.txt new file mode 100644 index 0000000..616eb29 --- /dev/null +++ b/installer/packages/riseupvpn/data/README.txt @@ -0,0 +1 @@ +RiseupVPN README diff --git a/installer/packages/riseupvpn/meta/install.js b/installer/packages/riseupvpn/meta/install.js new file mode 100644 index 0000000..e5174e1 --- /dev/null +++ b/installer/packages/riseupvpn/meta/install.js @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2020 LEAP +** +****************************************************************************/ + +function Component() { +} + +Component.prototype.createOperations = function () +{ + // This will actually install the files + component.createOperations(); + + // And now our custom actions. + // See https://doc.qt.io/qtinstallerframework/operations.html for reference + // + // We can also use this to register different components (different architecture for instance) + // See https://doc.qt.io/qtinstallerframework/qt-installer-framework-systeminfo-packages-root-meta-installscript-qs.html + + console.log("Post installation. Checking platform...") + if (systemInfo.productType === "windows") { + console.log("Platform: windows"); + postInstallWindows(); + } else if (systemInfo.productType === "osx") { + console.log("Platform: osx"); + postInstallOSX(); + } else { + console.log("Platform: linux"); + postInstallLinux(); + } +} + +function postInstallWindows() { + component.addOperation("CreateShortcut", + "@TargetDir@/README.txt", + "@StartMenuDir@/README.lnk", + "workingDirectory=@TargetDir@", + "iconPath=%SystemRoot%/system32/SHELL32.dll", + "iconId=2"); +} + +function postInstallOSX() { + console.log("TODO: should do osx post-installation"); +} + +function postInstallLinux() { + console.log("TODO: should do linux post-installation"); + console.log("Maybe you want to use your package manager instead?"); + component.addOperation("AppendFile", "/tmp/riseupvpn.log", "this is a test - written from the installer"); +} diff --git a/installer/packages/riseupvpn/meta/package.xml b/installer/packages/riseupvpn/meta/package.xml new file mode 100644 index 0000000..4dd7ae9 --- /dev/null +++ b/installer/packages/riseupvpn/meta/package.xml @@ -0,0 +1,11 @@ + + + RiseupVPN + RiseupVPN + 0.20.6-1 + 2020-07-01 + false + true + + true + -- cgit v1.2.3