mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-04-02 18:31:50 -04:00
update packaging
This commit is contained in:
parent
a70340ce55
commit
2cbce0be3f
@ -3,6 +3,7 @@
|
|||||||
#include "enhancedwebview.h"
|
#include "enhancedwebview.h"
|
||||||
|
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
#include <QProcessEnvironment>
|
||||||
#include <plog/Log.h>
|
#include <plog/Log.h>
|
||||||
#include <plog/Appenders/ColorConsoleAppender.h>
|
#include <plog/Appenders/ColorConsoleAppender.h>
|
||||||
|
|
||||||
@ -28,6 +29,8 @@ int main(int argc, char *argv[])
|
|||||||
qputenv(ENV_CDP_PORT, "12315");
|
qputenv(ENV_CDP_PORT, "12315");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PLOGI << "ENV: " << QProcessEnvironment::systemEnvironment().toStringList().join("\n");
|
||||||
|
|
||||||
SingleApplication app(argc, argv);
|
SingleApplication app(argc, argv);
|
||||||
app.setQuitOnLastWindowClosed(false);
|
app.setQuitOnLastWindowClosed(false);
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
TARGET = gpservice
|
TARGET = gpservice
|
||||||
|
|
||||||
QT += dbus
|
#QT += dbus
|
||||||
QT -= gui
|
QT -= gui
|
||||||
|
|
||||||
CONFIG += c++11 console
|
CONFIG += c++11 console
|
||||||
@ -21,32 +21,32 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
|||||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
gpservice.h \
|
# gpservice.h \
|
||||||
sigwatch.h
|
sigwatch.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
gpservice.cpp \
|
# gpservice.cpp \
|
||||||
main.cpp \
|
main.cpp \
|
||||||
sigwatch.cpp
|
sigwatch.cpp
|
||||||
|
|
||||||
DBUS_ADAPTORS += gpservice.xml
|
#DBUS_ADAPTORS += gpservice.xml
|
||||||
|
|
||||||
# Default rules for deployment.
|
# Default rules for deployment.
|
||||||
target.path = /usr/bin
|
target.path = /usr/bin
|
||||||
INSTALLS += target
|
INSTALLS += target
|
||||||
|
|
||||||
DISTFILES += \
|
#DISTFILES += \
|
||||||
dbus/com.yuezk.qt.GPService.conf \
|
# dbus/com.yuezk.qt.GPService.conf \
|
||||||
dbus/com.yuezk.qt.GPService.service \
|
# dbus/com.yuezk.qt.GPService.service \
|
||||||
systemd/gpservice.service
|
# systemd/gpservice.service
|
||||||
|
|
||||||
dbus_config.path = /usr/share/dbus-1/system.d/
|
#dbus_config.path = /usr/share/dbus-1/system.d/
|
||||||
dbus_config.files = dbus/com.yuezk.qt.GPService.conf
|
#dbus_config.files = dbus/com.yuezk.qt.GPService.conf
|
||||||
|
|
||||||
dbus_service.path = /usr/share/dbus-1/system-services/
|
#dbus_service.path = /usr/share/dbus-1/system-services/
|
||||||
dbus_service.files = dbus/com.yuezk.qt.GPService.service
|
#dbus_service.files = dbus/com.yuezk.qt.GPService.service
|
||||||
|
|
||||||
systemd_service.path = /etc/systemd/system/
|
#systemd_service.path = /etc/systemd/system/
|
||||||
systemd_service.files = systemd/gpservice.service
|
#systemd_service.files = systemd/gpservice.service
|
||||||
|
|
||||||
INSTALLS += dbus_config dbus_service systemd_service
|
#INSTALLS += dbus_config dbus_service systemd_service
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <QtDBus>
|
#include <QtDBus>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
#include <QProcessEnvironment>
|
||||||
|
|
||||||
GPService::GPService(QObject *parent)
|
GPService::GPService(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
@ -99,22 +100,16 @@ void GPService::connect(QString server, QString username, QString passwd, QStrin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
log("Before findBinary");
|
QString bin = findBinary();
|
||||||
|
if (bin == nullptr) {
|
||||||
// QString bin = findBinary();
|
log("Could not find openconnect binary, make sure openconnect is installed, exiting.");
|
||||||
|
emit error("The OpenConect CLI was not found, make sure it has been installed!");
|
||||||
// log("After findBinary");
|
return;
|
||||||
|
}
|
||||||
// if (bin == nullptr) {
|
|
||||||
// log("Could not find openconnect binary, make sure openconnect is installed, exiting.");
|
|
||||||
// emit error("The OpenConect CLI was not found, make sure it has been installed!");
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
QStringList args;
|
QStringList args;
|
||||||
args << QCoreApplication::arguments().mid(1)
|
args << QCoreApplication::arguments().mid(1)
|
||||||
<< "--protocol=gp"
|
<< "--protocol=gp"
|
||||||
<< "-s" << qgetenv("VPNC_SCRIPT")
|
|
||||||
<< splitCommand(extraArgs)
|
<< splitCommand(extraArgs)
|
||||||
<< "-u" << username
|
<< "-u" << username
|
||||||
<< "-C" << passwd
|
<< "-C" << passwd
|
||||||
@ -122,7 +117,9 @@ void GPService::connect(QString server, QString username, QString passwd, QStrin
|
|||||||
|
|
||||||
log("Start process with arugments: " + args.join(" "));
|
log("Start process with arugments: " + args.join(" "));
|
||||||
|
|
||||||
openconnect->start("openconnect", args);
|
log("ENV for OC: " + openconnect->environment().join("\n"));
|
||||||
|
log("ENV for gpservice: " + QProcessEnvironment::systemEnvironment().toStringList().join("\n"));
|
||||||
|
openconnect->start(bin, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPService::disconnect()
|
void GPService::disconnect()
|
||||||
|
@ -1,26 +1,33 @@
|
|||||||
#include <QtDBus>
|
//#include "gpservice.h"
|
||||||
#include "gpservice.h"
|
|
||||||
#include "singleapplication.h"
|
#include "singleapplication.h"
|
||||||
#include "sigwatch.h"
|
#include "sigwatch.h"
|
||||||
|
#include "iostream"
|
||||||
|
|
||||||
|
//#include <QtDBus>
|
||||||
|
#include <QProcessEnvironment>
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
SingleApplication app(argc, argv);
|
SingleApplication app(argc, argv);
|
||||||
|
|
||||||
if (!QDBusConnection::systemBus().isConnected()) {
|
// if (!QDBusConnection::systemBus().isConnected()) {
|
||||||
qWarning("Cannot connect to the D-Bus session bus.\n"
|
// qWarning("Cannot connect to the D-Bus session bus.\n"
|
||||||
"Please check your system settings and try again.\n");
|
// "Please check your system settings and try again.\n");
|
||||||
return 1;
|
// return 1;
|
||||||
}
|
// }
|
||||||
|
|
||||||
GPService service;
|
// GPService service;
|
||||||
|
|
||||||
|
QString env = "ENV: " + QProcessEnvironment::systemEnvironment().toStringList().join("\n");
|
||||||
|
std::cout << env.toStdString();
|
||||||
|
|
||||||
UnixSignalWatcher sigwatch;
|
UnixSignalWatcher sigwatch;
|
||||||
sigwatch.watchForSignal(SIGINT);
|
sigwatch.watchForSignal(SIGINT);
|
||||||
sigwatch.watchForSignal(SIGTERM);
|
sigwatch.watchForSignal(SIGTERM);
|
||||||
sigwatch.watchForSignal(SIGQUIT);
|
sigwatch.watchForSignal(SIGQUIT);
|
||||||
sigwatch.watchForSignal(SIGHUP);
|
sigwatch.watchForSignal(SIGHUP);
|
||||||
QObject::connect(&sigwatch, &UnixSignalWatcher::unixSignal, &service, &GPService::quit);
|
// QObject::connect(&sigwatch, &UnixSignalWatcher::unixSignal, &service, &GPService::quit);
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,15 @@ description: |
|
|||||||
grade: devel
|
grade: devel
|
||||||
confinement: devmode # use 'strict' once you have the right plugs and slots
|
confinement: devmode # use 'strict' once you have the right plugs and slots
|
||||||
|
|
||||||
|
package-repositories:
|
||||||
|
- type: apt
|
||||||
|
ppa: dwmw2/openconnect
|
||||||
|
|
||||||
layout:
|
layout:
|
||||||
|
/usr/share/vpnc-scripts:
|
||||||
|
bind: $SNAP/usr/share/vpnc-scripts
|
||||||
|
/usr/local/sbin:
|
||||||
|
bind: $SNAP/usr/local/sbin
|
||||||
/usr/share/qt5:
|
/usr/share/qt5:
|
||||||
bind: $SNAP/usr/share/qt5
|
bind: $SNAP/usr/share/qt5
|
||||||
|
|
||||||
@ -26,11 +34,12 @@ plugs:
|
|||||||
|
|
||||||
apps:
|
apps:
|
||||||
gpservice:
|
gpservice:
|
||||||
daemon: simple
|
# daemon: simple
|
||||||
command: usr/bin/gpservice
|
command: usr/bin/gpservice
|
||||||
|
extensions:
|
||||||
|
- kde-neon
|
||||||
environment:
|
environment:
|
||||||
LANG: en_US.utf8
|
LANG: en_US.utf8
|
||||||
VPNC_SCRIPT: $SNAP/usr/share/vpnc-scripts/vpnc-script
|
|
||||||
plugs:
|
plugs:
|
||||||
- network
|
- network
|
||||||
slots:
|
slots:
|
||||||
@ -39,12 +48,9 @@ apps:
|
|||||||
gpclient:
|
gpclient:
|
||||||
common-id: com.yuezk.qt.gpclient
|
common-id: com.yuezk.qt.gpclient
|
||||||
command: usr/bin/gpclient
|
command: usr/bin/gpclient
|
||||||
|
desktop: usr/share/applications/com.yuezk.qt.gpclient.desktop
|
||||||
extensions:
|
extensions:
|
||||||
- kde-neon
|
- kde-neon
|
||||||
desktop: usr/share/applications/com.yuezk.qt.gpclient.desktop
|
|
||||||
environment:
|
|
||||||
# QT_PLUGIN_PATH: $SNAP/opt/qt512/plugins
|
|
||||||
QT_PLUGIN_PATH: $SNAP/usr/lib/x86_64-linux-gnu/qt5/plugins
|
|
||||||
plugs:
|
plugs:
|
||||||
- desktop
|
- desktop
|
||||||
- desktop-legacy
|
- desktop-legacy
|
||||||
@ -55,162 +61,25 @@ apps:
|
|||||||
- gpservice-plug
|
- gpservice-plug
|
||||||
|
|
||||||
parts:
|
parts:
|
||||||
gmplib:
|
|
||||||
plugin: autotools
|
|
||||||
source: https://gmplib.org/download/gmp/gmp-6.2.1.tar.xz
|
|
||||||
|
|
||||||
nettle:
|
|
||||||
plugin: autotools
|
|
||||||
source: https://ftp.gnu.org/gnu/nettle/nettle-3.7.3.tar.gz
|
|
||||||
configflags:
|
|
||||||
- --disable-openssl
|
|
||||||
- --disable-documentation
|
|
||||||
after:
|
|
||||||
- gmplib
|
|
||||||
|
|
||||||
tpm2-tss:
|
|
||||||
plugin: autotools
|
|
||||||
source: https://github.com/tpm2-software/tpm2-tss.git
|
|
||||||
source-depth: 1
|
|
||||||
source-tag: 3.1.0
|
|
||||||
build-packages:
|
|
||||||
- autoconf-archive
|
|
||||||
- libcmocka-dev
|
|
||||||
- build-essential
|
|
||||||
- pkg-config
|
|
||||||
- libtool
|
|
||||||
- automake
|
|
||||||
- libssl-dev
|
|
||||||
- autoconf
|
|
||||||
- libjson-c-dev
|
|
||||||
- libini-config-dev
|
|
||||||
- libcurl4-openssl-dev
|
|
||||||
- acl
|
|
||||||
stage-packages:
|
|
||||||
- libasn1-8-heimdal
|
|
||||||
- libcurl4
|
|
||||||
- libgssapi3-heimdal
|
|
||||||
- libhcrypto4-heimdal
|
|
||||||
- libheimbase1-heimdal
|
|
||||||
- libheimntlm0-heimdal
|
|
||||||
- libhx509-5-heimdal
|
|
||||||
- libkrb5-26-heimdal
|
|
||||||
- libldap-2.4-2
|
|
||||||
- libnghttp2-14
|
|
||||||
- libpsl5
|
|
||||||
- libroken18-heimdal
|
|
||||||
- librtmp1
|
|
||||||
- libsasl2-2
|
|
||||||
- libwind0-heimdal
|
|
||||||
configflags:
|
|
||||||
- --disable-doxygen-doc
|
|
||||||
|
|
||||||
gnutls:
|
|
||||||
plugin: autotools
|
|
||||||
source: http://mirrors.dotsrc.org/gcrypt/gnutls/v3.7/gnutls-3.7.2.tar.xz
|
|
||||||
build-packages:
|
|
||||||
- wget
|
|
||||||
- build-essential
|
|
||||||
- autoconf
|
|
||||||
- libtool
|
|
||||||
- gettext
|
|
||||||
- autopoint
|
|
||||||
- automake
|
|
||||||
- autogen
|
|
||||||
- libp11-kit-dev
|
|
||||||
- libtspi-dev
|
|
||||||
- libunistring-dev
|
|
||||||
- guile-2.2-dev
|
|
||||||
- libtasn1-6-dev
|
|
||||||
- libidn2-0-dev
|
|
||||||
- gperf
|
|
||||||
- libunbound-dev
|
|
||||||
- bison
|
|
||||||
stage-packages:
|
|
||||||
- guile-2.2-libs
|
|
||||||
- libgc1c2
|
|
||||||
- libltdl7
|
|
||||||
- libopts25
|
|
||||||
- libunbound2
|
|
||||||
configflags:
|
|
||||||
- --disable-doc
|
|
||||||
- --disable-full-test-suite
|
|
||||||
after:
|
|
||||||
- gmplib
|
|
||||||
- nettle
|
|
||||||
|
|
||||||
libpskc:
|
|
||||||
plugin: autotools
|
|
||||||
source: https://download.savannah.nongnu.org/releases/oath-toolkit/oath-toolkit-2.6.7.tar.gz
|
|
||||||
source-subdir: libpskc
|
|
||||||
build-packages:
|
|
||||||
- build-essential
|
|
||||||
- autoconf
|
|
||||||
- automake
|
|
||||||
- libtool
|
|
||||||
- bison
|
|
||||||
- gengetopt
|
|
||||||
- libxmlsec1-dev
|
|
||||||
- libxml2-utils
|
|
||||||
|
|
||||||
openconnect:
|
|
||||||
plugin: autotools
|
|
||||||
source: https://github.com/openconnect/openconnect.git
|
|
||||||
source-depth: 1
|
|
||||||
source-tag: v8.10
|
|
||||||
build-packages:
|
|
||||||
- build-essential
|
|
||||||
- gettext
|
|
||||||
- autoconf
|
|
||||||
- automake
|
|
||||||
- libtool
|
|
||||||
- libxml2-dev
|
|
||||||
- zlib1g-dev
|
|
||||||
- pkg-config
|
|
||||||
- libp11-kit-dev
|
|
||||||
- libproxy-dev
|
|
||||||
- trousers
|
|
||||||
- libtasn1-6-dev
|
|
||||||
- libstoken-dev
|
|
||||||
- libpcsclite-dev
|
|
||||||
- vpnc-scripts
|
|
||||||
stage-packages:
|
|
||||||
- vpnc-scripts
|
|
||||||
- libp11-kit0
|
|
||||||
- libproxy1v5
|
|
||||||
- libstoken1
|
|
||||||
- libpcsclite1
|
|
||||||
- libxml2
|
|
||||||
- zlib1g
|
|
||||||
after:
|
|
||||||
- gnutls
|
|
||||||
- tpm2-tss
|
|
||||||
- libpskc
|
|
||||||
|
|
||||||
application:
|
application:
|
||||||
plugin: qmake
|
plugin: nil
|
||||||
build-attributes:
|
|
||||||
- keep-execstack
|
|
||||||
source: .
|
source: .
|
||||||
build-packages:
|
build-snaps:
|
||||||
- qt5-default
|
- kde-frameworks-5-core18-sdk
|
||||||
- qtwebengine5-dev
|
stage-snaps:
|
||||||
- libqt5websockets5-dev
|
- kde-frameworks-5-core18
|
||||||
stage-packages:
|
stage-packages:
|
||||||
- libqt5printsupport5
|
- openconnect
|
||||||
- libqt5gui5
|
override-build: |
|
||||||
- libqt5network5
|
KF5_DIR=/snap/kde-frameworks-5-core18-sdk/current
|
||||||
- libqt5svg5
|
|
||||||
- libqt5webengine5
|
|
||||||
- libqt5websockets5
|
|
||||||
- libqt5quickwidgets5
|
|
||||||
- libqt5webenginewidgets5
|
|
||||||
- libqt5dbus5
|
|
||||||
- libatm1
|
|
||||||
- libtspi1
|
|
||||||
- libxmlsec1
|
|
||||||
- libxmlsec1-openssl
|
|
||||||
options:
|
|
||||||
- CONFIG+=release
|
|
||||||
|
|
||||||
|
export QTDIR=$KF5_DIR/usr/lib/qt5
|
||||||
|
export PATH=$QTDIR/bin:$KF5_DIR/usr/bin:$PATH
|
||||||
|
export LD_LIBRARY_PATH=$KF5_DIR/usr/lib/$SNAPCRAFT_ARCH_TRIPLET:$QTDIR/lib:$LD_LIBRARY_PATH
|
||||||
|
export PKG_CONFIG_PATH=$QTDIR/lib/pkgconfig:$PKG_CONFIG_PATH
|
||||||
|
export QMAKESPEC=$KF5_DIR/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/mkspecs/linux-g++
|
||||||
|
# export QT_SELECT=qt5
|
||||||
|
|
||||||
|
qmake CONFIG+=release # -qtconf $KF5_DIR/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/qt.conf
|
||||||
|
make -j$(nproc)
|
||||||
|
make INSTALL_ROOT=$SNAPCRAFT_PART_INSTALL install
|
||||||
|
Loading…
Reference in New Issue
Block a user