update packaging

This commit is contained in:
Kevin Yue 2021-09-05 23:35:49 +08:00
parent 4843bac643
commit bb78aed8eb
4 changed files with 88 additions and 29 deletions

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>com.yuezk.qt.gpclient</id>
<name>globalprotect-openconnect</name>
<summary>A GlobalProtect VPN client powered by OpenConnect</summary>
<metadata_license>CC0-1.0</metadata_license>
<project_license>AGPL-3.0-or-later</project_license>
<description>
<p>A GlobalProtect VPN client (GUI) for Linux based on OpenConnect and built with Qt5, supports the SAML auth mode.</p>
</description>
<categories>
<category>Network</category>
</categories>
<update_contact>k3vinyue_AT_gmail.com</update_contact>
<developer_name>Kevin Yue</developer_name>
<url type="homepage">https://github.com/yuezk/GlobalProtect-openconnect</url>
<url type="bugtracker">https://github.com/yuezk/GlobalProtect-openconnect/issues</url>
<url type="help">https://github.com/yuezk/GlobalProtect-openconnect/issues</url>
<keywords>
<keyword>globalprotect</keyword>
<keyword>openconnect</keyword>
<keyword>vpn</keyword>
<keyword>saml</keyword>
</keywords>
<launchable type="desktop-id">com.yuezk.qt.gpclient.desktop</launchable>
<screenshots>
<screenshot type="default">
<image>https://raw.githubusercontent.com/yuezk/GlobalProtect-openconnect/master/screenshot.png</image>
</screenshot>
</screenshots>
<provides>
<binary>/usr/bin/gpclient</binary>
<dbus type="system">com.yuezk.qt.GPService</dbus>
</provides>
</component>

View File

@ -20,6 +20,7 @@ int main(int argc, char *argv[])
plog::init(plog::debug, logFile.toUtf8()).addAppender(&consoleAppender); plog::init(plog::debug, logFile.toUtf8()).addAppender(&consoleAppender);
PLOGI << "GlobalProtect started, version: " << version; PLOGI << "GlobalProtect started, version: " << version;
PLOGI << "PATH: " << qgetenv("PATH");
QString port = QString::fromLocal8Bit(qgetenv(ENV_CDP_PORT)); QString port = QString::fromLocal8Bit(qgetenv(ENV_CDP_PORT));

View File

@ -92,17 +92,24 @@ void GPService::quit()
void GPService::connect(QString server, QString username, QString passwd, QString extraArgs) void GPService::connect(QString server, QString username, QString passwd, QString extraArgs)
{ {
log("VPN status is: " + QVariant::fromValue(vpnStatus).toString());
if (vpnStatus != GPService::VpnNotConnected) { if (vpnStatus != GPService::VpnNotConnected) {
log("VPN status is: " + QVariant::fromValue(vpnStatus).toString()); log("VPN status is: " + QVariant::fromValue(vpnStatus).toString());
return; return;
} }
QString bin = findBinary(); log("Before findBinary");
if (bin == nullptr) {
log("Could not find openconnect binary, make sure openconnect is installed, exiting."); // QString bin = findBinary();
emit error("The OpenConect CLI was not found, make sure it has been installed!");
return; // log("After findBinary");
}
// 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)
@ -114,7 +121,7 @@ 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(bin, args); openconnect->start("openconnect", args);
} }
void GPService::disconnect() void GPService::disconnect()

View File

@ -11,32 +11,56 @@ confinement: devmode # use 'strict' once you have the right plugs and slots
package-repositories: package-repositories:
- type: apt - type: apt
ppa: beineri/opt-qt-5.12.10-bionic ppa: beineri/opt-qt-5.12.10-bionic
- type: apt
ppa: dominik-stadler/dsta-bionic-ppa
slots:
gpservice-slot:
interface: dbus
bus: system
name: com.yuezk.qt.GPService
plugs:
gpservice-plug:
interface: dbus
bus: system
name: com.yuezk.qt.GPService
apps: apps:
gpservice:
daemon: simple
command: usr/bin/gpservice
environment:
LANG: en_US.utf8
plugs:
- network
# slots:
# - gpservice-slot
gpclient: gpclient:
common-id: com.yuezk.qt.gpclient.desktop common-id: com.yuezk.qt.gpclient.desktop
command: desktop-launch gpclient command: usr/bin/gpclient
desktop: usr/share/applications/com.yuezk.qt.gpclient.desktop desktop: usr/share/applications/com.yuezk.qt.gpclient.desktop
environment: environment:
QT_DEBUG_PLUGINS: 1 QT_PLUGIN_PATH: $SNAP/opt/qt512/plugins
plugs: plugs:
- desktop - desktop
- desktop-legacy - desktop-legacy
- opengl
- wayland - wayland
- unity7
- x11 - x11
- network - network
# extensions: - gpservice-plug
# - kde-neon
parts: parts:
application: application:
plugin: nil plugin: nil
source: snap/local/globalprotect-openconnect.tar.gz source: .
build-packages: build-packages:
- g++ - g++
- make - make
- libgl1-mesa-dev
- qt512base - qt512base
- qt512websockets - qt512websockets
- qt512webengine - qt512webengine
@ -46,22 +70,6 @@ parts:
- qt512websockets - qt512websockets
- qt512webengine - qt512webengine
# build-packages:
# - g++
# - make
# - qt5-qmake
# - qtwebengine5-dev
# - libqt5websockets5-dev
# build-snaps:
# - kde-frameworks-5-qt-5-14-core18-sdk
# stage-packages:
# - libqt5widgets5
# - libqt5webengine5
# - libqt5webenginewidgets5
# - libqt5websockets5
override-build: | override-build: |
QT_BASE_DIR=/opt/qt512 QT_BASE_DIR=/opt/qt512