mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-04-02 18:31:50 -04:00
Add snap packaging (#93)
* snapcraft init * update packaging * update packaging * update packaging * update packaging * update packaging * update packaging * snap worked * fix locale warning * polish code * update metainfo * update icon * update icon * update message
This commit is contained in:
parent
452fe2f189
commit
bc07e3d496
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,6 +4,7 @@ gpservice
|
|||||||
|
|
||||||
*.rpm
|
*.rpm
|
||||||
*.gz
|
*.gz
|
||||||
|
*.snap
|
||||||
.DS_Store
|
.DS_Store
|
||||||
build-debian
|
build-debian
|
||||||
build
|
build
|
||||||
|
14
3rdparty/qt-unix-signals/CMakeLists.txt
vendored
Normal file
14
3rdparty/qt-unix-signals/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.1.0)
|
||||||
|
|
||||||
|
project(QtSignals LANGUAGES CXX)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
# Instruct CMake to run moc automatically when needed.
|
||||||
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
|
||||||
|
find_package(Qt5 REQUIRED COMPONENTS Core)
|
||||||
|
|
||||||
|
add_library(QtSignals sigwatch.cpp)
|
||||||
|
target_include_directories(QtSignals INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
target_link_libraries(QtSignals Qt5::Core)
|
21
3rdparty/qt-unix-signals/LICENCE
vendored
Normal file
21
3rdparty/qt-unix-signals/LICENCE
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
Unix signal watcher for Qt.
|
||||||
|
|
||||||
|
Copyright (C) 2014 Simon Knopp
|
||||||
|
|
||||||
|
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 the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
@ -22,5 +22,7 @@ find_package(Qt5 REQUIRED COMPONENTS
|
|||||||
DBus
|
DBus
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_subdirectory(3rdparty/qt-unix-signals)
|
||||||
add_subdirectory(GPService)
|
add_subdirectory(GPService)
|
||||||
add_subdirectory(GPClient)
|
add_subdirectory(GPClient)
|
||||||
|
add_dependencies(gpclient gpservice)
|
||||||
|
@ -4,7 +4,11 @@ project(GPClient)
|
|||||||
|
|
||||||
set(gpclient_GENERATED_SOURCES)
|
set(gpclient_GENERATED_SOURCES)
|
||||||
|
|
||||||
qt5_add_dbus_interface(gpclient_GENERATED_SOURCES ${CMAKE_BINARY_DIR}/com.yuezk.qt.GPService.xml gpserviceinterface)
|
qt5_add_dbus_interface(
|
||||||
|
gpclient_GENERATED_SOURCES
|
||||||
|
${CMAKE_BINARY_DIR}/com.yuezk.qt.GPService.xml
|
||||||
|
gpserviceinterface
|
||||||
|
)
|
||||||
|
|
||||||
add_executable(gpclient
|
add_executable(gpclient
|
||||||
cdpcommand.cpp
|
cdpcommand.cpp
|
||||||
@ -34,7 +38,13 @@ add_3rdparty(
|
|||||||
SingleApplication
|
SingleApplication
|
||||||
GIT_REPOSITORY https://github.com/itay-grudev/SingleApplication.git
|
GIT_REPOSITORY https://github.com/itay-grudev/SingleApplication.git
|
||||||
GIT_TAG v3.3.0
|
GIT_TAG v3.3.0
|
||||||
CMAKE_ARGS -DQAPPLICATION_CLASS=QApplication
|
CMAKE_ARGS
|
||||||
|
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||||
|
-DCMAKE_FIND_ROOT_PATH=${CMAKE_FIND_ROOT_PATH}
|
||||||
|
-DCMAKE_PREFIX_PATH=$ENV{CMAKE_PREFIX_PATH}
|
||||||
|
-DCMAKE_INCLUDE_PATH=$ENV{CMAKE_INCLUDE_PATH}
|
||||||
|
-DCMAKE_LIBRARY_PATH=$ENV{CMAKE_LIBRARY_PATH}
|
||||||
|
-DQAPPLICATION_CLASS=QApplication
|
||||||
)
|
)
|
||||||
|
|
||||||
add_3rdparty(
|
add_3rdparty(
|
||||||
@ -69,10 +79,13 @@ target_link_libraries(gpclient
|
|||||||
Qt5::WebEngine
|
Qt5::WebEngine
|
||||||
Qt5::WebEngineWidgets
|
Qt5::WebEngineWidgets
|
||||||
Qt5::DBus
|
Qt5::DBus
|
||||||
|
QtSignals
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_definitions(gpclient PUBLIC QAPPLICATION_CLASS=QApplication)
|
target_compile_definitions(gpclient PUBLIC QAPPLICATION_CLASS=QApplication)
|
||||||
|
|
||||||
install(TARGETS gpclient DESTINATION "/usr/bin")
|
install(TARGETS gpclient DESTINATION "/usr/bin")
|
||||||
|
install(FILES com.yuezk.qt.gpclient.metainfo.xml DESTINATION "/usr/share/metainfo")
|
||||||
install(FILES com.yuezk.qt.gpclient.desktop DESTINATION "/usr/share/applications")
|
install(FILES com.yuezk.qt.gpclient.desktop DESTINATION "/usr/share/applications")
|
||||||
|
install(FILES com.yuezk.qt.GPClient.svg DESTINATION "/usr/share/icons/hicolor/scalable/apps")
|
||||||
install(FILES com.yuezk.qt.GPClient.svg DESTINATION "/usr/share/pixmaps")
|
install(FILES com.yuezk.qt.GPClient.svg DESTINATION "/usr/share/pixmaps")
|
||||||
|
43
GPClient/com.yuezk.qt.gpclient.metainfo.xml
Normal file
43
GPClient/com.yuezk.qt.gpclient.metainfo.xml
Normal 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://user-images.githubusercontent.com/3297602/133869036-5c02b0d9-c2d9-4f87-8c81-e44f68cfd6ac.png</image>
|
||||||
|
</screenshot>
|
||||||
|
</screenshots>
|
||||||
|
<provides>
|
||||||
|
<binary>/usr/bin/gpclient</binary>
|
||||||
|
<dbus type="system">com.yuezk.qt.GPService</dbus>
|
||||||
|
</provides>
|
||||||
|
</component>
|
@ -23,6 +23,7 @@ public:
|
|||||||
~GPClient();
|
~GPClient();
|
||||||
|
|
||||||
void activate();
|
void activate();
|
||||||
|
void quit();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onSettingsButtonClicked();
|
void onSettingsButtonClicked();
|
||||||
@ -97,6 +98,5 @@ private:
|
|||||||
void setCurrentGateway(const GPGateway gateway);
|
void setCurrentGateway(const GPGateway gateway);
|
||||||
|
|
||||||
void clearSettings();
|
void clearSettings();
|
||||||
void quit();
|
|
||||||
};
|
};
|
||||||
#endif // GPCLIENT_H
|
#endif // GPCLIENT_H
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include "singleapplication.h"
|
#include "singleapplication.h"
|
||||||
#include "gpclient.h"
|
#include "gpclient.h"
|
||||||
#include "enhancedwebview.h"
|
#include "enhancedwebview.h"
|
||||||
|
#include "sigwatch.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
@ -37,5 +38,12 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
QObject::connect(&app, &SingleApplication::instanceStarted, &w, &GPClient::activate);
|
QObject::connect(&app, &SingleApplication::instanceStarted, &w, &GPClient::activate);
|
||||||
|
|
||||||
|
UnixSignalWatcher sigwatch;
|
||||||
|
sigwatch.watchForSignal(SIGINT);
|
||||||
|
sigwatch.watchForSignal(SIGTERM);
|
||||||
|
sigwatch.watchForSignal(SIGQUIT);
|
||||||
|
sigwatch.watchForSignal(SIGHUP);
|
||||||
|
QObject::connect(&sigwatch, &UnixSignalWatcher::unixSignal, &w, &GPClient::quit);
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,10 @@ project(GPService)
|
|||||||
set(gpservice_GENERATED_SOURCES)
|
set(gpservice_GENERATED_SOURCES)
|
||||||
|
|
||||||
# generate the dbus xml definition
|
# generate the dbus xml definition
|
||||||
qt5_generate_dbus_interface(gpservice.h ${CMAKE_BINARY_DIR}/com.yuezk.qt.GPService.xml)
|
qt5_generate_dbus_interface(
|
||||||
|
gpservice.h
|
||||||
|
${CMAKE_BINARY_DIR}/com.yuezk.qt.GPService.xml
|
||||||
|
)
|
||||||
|
|
||||||
# generate dbus adaptor
|
# generate dbus adaptor
|
||||||
qt5_add_dbus_adaptor(
|
qt5_add_dbus_adaptor(
|
||||||
@ -18,7 +21,6 @@ qt5_add_dbus_adaptor(
|
|||||||
add_executable(gpservice
|
add_executable(gpservice
|
||||||
gpservice.cpp
|
gpservice.cpp
|
||||||
main.cpp
|
main.cpp
|
||||||
sigwatch.cpp
|
|
||||||
${gpservice_GENERATED_SOURCES}
|
${gpservice_GENERATED_SOURCES}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -26,7 +28,13 @@ add_3rdparty(
|
|||||||
SingleApplication
|
SingleApplication
|
||||||
GIT_REPOSITORY https://github.com/itay-grudev/SingleApplication.git
|
GIT_REPOSITORY https://github.com/itay-grudev/SingleApplication.git
|
||||||
GIT_TAG v3.3.0
|
GIT_TAG v3.3.0
|
||||||
CMAKE_ARGS -DQAPPLICATION_CLASS=QCoreApplication
|
CMAKE_ARGS
|
||||||
|
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||||
|
-DCMAKE_FIND_ROOT_PATH=${CMAKE_FIND_ROOT_PATH}
|
||||||
|
-DCMAKE_PREFIX_PATH=$ENV{CMAKE_PREFIX_PATH}
|
||||||
|
-DCMAKE_INCLUDE_PATH=$ENV{CMAKE_INCLUDE_PATH}
|
||||||
|
-DCMAKE_LIBRARY_PATH=$ENV{CMAKE_LIBRARY_PATH}
|
||||||
|
-DQAPPLICATION_CLASS=QCoreApplication
|
||||||
)
|
)
|
||||||
|
|
||||||
ExternalProject_Get_Property(SingleApplication-${PROJECT_NAME} SOURCE_DIR BINARY_DIR)
|
ExternalProject_Get_Property(SingleApplication-${PROJECT_NAME} SOURCE_DIR BINARY_DIR)
|
||||||
@ -47,6 +55,7 @@ target_link_libraries(gpservice
|
|||||||
Qt5::Core
|
Qt5::Core
|
||||||
Qt5::Network
|
Qt5::Network
|
||||||
Qt5::DBus
|
Qt5::DBus
|
||||||
|
QtSignals
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_definitions(gpservice PUBLIC QAPPLICATION_CLASS=QCoreApplication)
|
target_compile_definitions(gpservice PUBLIC QAPPLICATION_CLASS=QCoreApplication)
|
||||||
|
@ -139,7 +139,7 @@ bool GPService::isValidVersion(QString &bin) {
|
|||||||
QString majorVersion = match.captured(1);
|
QString majorVersion = match.captured(1);
|
||||||
|
|
||||||
if (majorVersion.toInt() < 8) {
|
if (majorVersion.toInt() < 8) {
|
||||||
emit error("The OpenConnect version must greater than v8.0.0, but got " + fullVersion);
|
emit error("The OpenConnect version must greater than v8.0.0, got " + fullVersion);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
Name: globalprotect-openconnect
|
Name: globalprotect-openconnect
|
||||||
Version: 1.3.0+SNAPSHOT20210829120923
|
Version: 1.3.0+SNAPSHOT20210829120923
|
||||||
Release: 1
|
Release: 1
|
||||||
Summary: A GlobalProtect VPN client
|
Summary: A GlobalProtect VPN client powered by OpenConnect
|
||||||
|
|
||||||
License: GPLv3
|
License: GPLv3
|
||||||
URL: https://github.com/yuezk/GlobalProtect-openconnect
|
URL: https://github.com/yuezk/GlobalProtect-openconnect
|
||||||
|
84
snap/snapcraft.yaml
Normal file
84
snap/snapcraft.yaml
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
name: globalprotect-openconnect
|
||||||
|
base: core18
|
||||||
|
version: 'test'
|
||||||
|
grade: devel
|
||||||
|
confinement: devmode # use 'strict' once you have the right plugs and slots
|
||||||
|
compression: lzo
|
||||||
|
|
||||||
|
contact: k3vinyue@gmail.com
|
||||||
|
donation: https://www.buymeacoffee.com/yuezk
|
||||||
|
issues: https://github.com/yuezk/GlobalProtect-openconnect/issues
|
||||||
|
source-code: https://github.com/yuezk/GlobalProtect-openconnect
|
||||||
|
website: https://github.com/yuezk/GlobalProtect-openconnect
|
||||||
|
license: GPL-3.0
|
||||||
|
|
||||||
|
adopt-info: application
|
||||||
|
|
||||||
|
package-repositories:
|
||||||
|
- type: apt
|
||||||
|
ppa: dwmw2/openconnect
|
||||||
|
|
||||||
|
layout:
|
||||||
|
/usr/local/sbin:
|
||||||
|
bind: $SNAP/usr/sbin
|
||||||
|
/usr/share/vpnc-scripts:
|
||||||
|
bind: $SNAP/usr/share/vpnc-scripts
|
||||||
|
/usr/share/locale:
|
||||||
|
bind: $SNAP/usr/share/locale
|
||||||
|
|
||||||
|
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:
|
||||||
|
gpservice:
|
||||||
|
daemon: simple
|
||||||
|
command: usr/bin/gpservice
|
||||||
|
command-chain:
|
||||||
|
- snap/command-chain/desktop-launch
|
||||||
|
environment:
|
||||||
|
LC_ALL: en_US.UTF-8
|
||||||
|
LANG: en_US.UTF-8
|
||||||
|
plugs:
|
||||||
|
- network
|
||||||
|
slots:
|
||||||
|
- gpservice-slot
|
||||||
|
|
||||||
|
gpclient:
|
||||||
|
common-id: com.yuezk.qt.gpclient
|
||||||
|
command: usr/bin/gpclient
|
||||||
|
desktop: usr/share/applications/com.yuezk.qt.gpclient.desktop
|
||||||
|
extensions:
|
||||||
|
- kde-neon
|
||||||
|
plugs:
|
||||||
|
- desktop
|
||||||
|
- desktop-legacy
|
||||||
|
- wayland
|
||||||
|
- unity7
|
||||||
|
- x11
|
||||||
|
- network
|
||||||
|
- gpservice-plug
|
||||||
|
|
||||||
|
parts:
|
||||||
|
application:
|
||||||
|
parse-info:
|
||||||
|
- usr/share/metainfo/com.yuezk.qt.gpclient.metainfo.xml
|
||||||
|
plugin: cmake
|
||||||
|
source: .
|
||||||
|
build-packages:
|
||||||
|
- libglu1-mesa-dev
|
||||||
|
build-snaps:
|
||||||
|
- kde-frameworks-5-core18-sdk
|
||||||
|
stage-packages:
|
||||||
|
- openconnect
|
||||||
|
- libatm1
|
||||||
|
configflags:
|
||||||
|
- -DCMAKE_BUILD_TYPE=Release
|
Loading…
Reference in New Issue
Block a user