mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-04-02 18:31:50 -04:00
merge master
This commit is contained in:
commit
283c772b7e
29
.github/workflows/main.yml
vendored
29
.github/workflows/main.yml
vendored
@ -2,29 +2,34 @@ name: Build
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ master ]
|
branches:
|
||||||
|
- master
|
||||||
|
- dev
|
||||||
|
paths-ignore:
|
||||||
|
- LICENSE
|
||||||
|
- "*.md"
|
||||||
|
- .vscode
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ master ]
|
branches:
|
||||||
|
- master
|
||||||
|
- dev
|
||||||
|
paths-ignore:
|
||||||
|
- LICENSE
|
||||||
|
- "*.md"
|
||||||
|
- .vscode
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-18.04
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Install Qt
|
|
||||||
uses: jurplel/install-qt-action@v2
|
|
||||||
with:
|
|
||||||
version: 5.12.11
|
|
||||||
modules: 'qtwebengine qtwebsockets'
|
|
||||||
|
|
||||||
# Checkout repository and submodules
|
# Checkout repository and submodules
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
- name: Build
|
- name: Build & Install
|
||||||
run: |
|
run: |
|
||||||
qmake CONFIG+=release
|
./scripts/install-ubuntu.sh
|
||||||
make
|
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -7,7 +7,9 @@ gpservice
|
|||||||
*.snap
|
*.snap
|
||||||
.DS_Store
|
.DS_Store
|
||||||
build-debian
|
build-debian
|
||||||
packaging/snap/local
|
build
|
||||||
|
|
||||||
|
.cmake
|
||||||
|
|
||||||
# Auto generated DBus files
|
# Auto generated DBus files
|
||||||
*_adaptor.cpp
|
*_adaptor.cpp
|
||||||
|
4
.gitmodules
vendored
4
.gitmodules
vendored
@ -1,7 +1,7 @@
|
|||||||
[submodule "singleapplication"]
|
[submodule "singleapplication"]
|
||||||
path = singleapplication
|
path = 3rdparty/SingleApplication
|
||||||
url = https://github.com/itay-grudev/SingleApplication.git
|
url = https://github.com/itay-grudev/SingleApplication.git
|
||||||
|
|
||||||
[submodule "plog"]
|
[submodule "plog"]
|
||||||
path = plog
|
path = 3rdparty/plog
|
||||||
url = https://github.com/SergiusTheBest/plog.git
|
url = https://github.com/SergiusTheBest/plog.git
|
||||||
|
23
.vscode/settings.json
vendored
Normal file
23
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"files.associations": {
|
||||||
|
"qregularexpression": "cpp",
|
||||||
|
"qfileinfo": "cpp",
|
||||||
|
"qregularexpressionmatch": "cpp",
|
||||||
|
"qdatetime": "cpp",
|
||||||
|
"qprocess": "cpp",
|
||||||
|
"qobject": "cpp",
|
||||||
|
"qstandardpaths": "cpp",
|
||||||
|
"qmainwindow": "cpp",
|
||||||
|
"qsystemtrayicon": "cpp",
|
||||||
|
"qpushbutton": "cpp",
|
||||||
|
"qmenu": "cpp",
|
||||||
|
"qjsondocument": "cpp",
|
||||||
|
"qnetworkaccessmanager": "cpp",
|
||||||
|
"qwebengineview": "cpp",
|
||||||
|
"qprocessenvironment": "cpp",
|
||||||
|
"qnetworkreply": "cpp",
|
||||||
|
"qicon": "cpp",
|
||||||
|
"qsslsocket": "cpp",
|
||||||
|
"qapplication": "cpp"
|
||||||
|
}
|
||||||
|
}
|
1
3rdparty/SingleApplication
vendored
Submodule
1
3rdparty/SingleApplication
vendored
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit bdbb09b5f21ebea4cd7dfb43b29114a94e04a3a1
|
1
3rdparty/plog
vendored
Submodule
1
3rdparty/plog
vendored
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit f4c22b03d5d3aa753cca8e716636ac4eb29b0917
|
26
CMakeLists.txt
Normal file
26
CMakeLists.txt
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.10.0)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
set(CMAKE_AUTORCC ON)
|
||||||
|
set(CMAKE_AUTOUIC ON)
|
||||||
|
|
||||||
|
file(READ "VERSION" ver)
|
||||||
|
project(GlobalProtect-openconnect VERSION ${ver} LANGUAGES CXX)
|
||||||
|
|
||||||
|
configure_file(version.h.in version.h)
|
||||||
|
|
||||||
|
find_package(Qt5 REQUIRED COMPONENTS
|
||||||
|
Core
|
||||||
|
Widgets
|
||||||
|
Network
|
||||||
|
WebSockets
|
||||||
|
WebEngine
|
||||||
|
WebEngineWidgets
|
||||||
|
DBus
|
||||||
|
)
|
||||||
|
|
||||||
|
add_subdirectory(GPService)
|
||||||
|
add_subdirectory(GPClient)
|
78
GPClient/CMakeLists.txt
Normal file
78
GPClient/CMakeLists.txt
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
include("${CMAKE_SOURCE_DIR}/cmake/Add3rdParty.cmake")
|
||||||
|
|
||||||
|
project(GPClient)
|
||||||
|
|
||||||
|
set(gpclient_GENERATED_SOURCES)
|
||||||
|
|
||||||
|
qt5_add_dbus_interface(gpclient_GENERATED_SOURCES ${CMAKE_BINARY_DIR}/com.yuezk.qt.GPService.xml gpserviceinterface)
|
||||||
|
|
||||||
|
add_executable(gpclient
|
||||||
|
cdpcommand.cpp
|
||||||
|
cdpcommandmanager.cpp
|
||||||
|
enhancedwebview.cpp
|
||||||
|
gatewayauthenticator.cpp
|
||||||
|
gatewayauthenticatorparams.cpp
|
||||||
|
gpgateway.cpp
|
||||||
|
gphelper.cpp
|
||||||
|
loginparams.cpp
|
||||||
|
main.cpp
|
||||||
|
normalloginwindow.cpp
|
||||||
|
portalauthenticator.cpp
|
||||||
|
portalconfigresponse.cpp
|
||||||
|
preloginresponse.cpp
|
||||||
|
samlloginwindow.cpp
|
||||||
|
gpclient.cpp
|
||||||
|
settingsdialog.cpp
|
||||||
|
gpclient.ui
|
||||||
|
normalloginwindow.ui
|
||||||
|
settingsdialog.ui
|
||||||
|
resources.qrc
|
||||||
|
${gpclient_GENERATED_SOURCES}
|
||||||
|
)
|
||||||
|
|
||||||
|
add_3rdparty(
|
||||||
|
SingleApplication
|
||||||
|
GIT_REPOSITORY https://github.com/itay-grudev/SingleApplication.git
|
||||||
|
GIT_TAG v3.3.0
|
||||||
|
CMAKE_ARGS -DQAPPLICATION_CLASS=QApplication
|
||||||
|
)
|
||||||
|
|
||||||
|
add_3rdparty(
|
||||||
|
plog
|
||||||
|
GIT_REPOSITORY https://github.com/SergiusTheBest/plog.git
|
||||||
|
GIT_TAG 1.1.5
|
||||||
|
CMAKE_ARGS -DPLOG_BUILD_SAMPLES=OFF
|
||||||
|
)
|
||||||
|
|
||||||
|
ExternalProject_Get_Property(SingleApplication-${PROJECT_NAME} SOURCE_DIR BINARY_DIR)
|
||||||
|
set(SingleApplication_INCLUDE_DIR ${SOURCE_DIR})
|
||||||
|
set(SingleApplication_LIBRARY ${BINARY_DIR}/libSingleApplication.a)
|
||||||
|
|
||||||
|
ExternalProject_Get_Property(plog-${PROJECT_NAME} SOURCE_DIR)
|
||||||
|
set(plog_INCLUDE_DIR "${SOURCE_DIR}/include")
|
||||||
|
|
||||||
|
add_dependencies(gpclient SingleApplication-${PROJECT_NAME} plog-${PROJECT_NAME})
|
||||||
|
|
||||||
|
target_include_directories(gpclient PRIVATE
|
||||||
|
${CMAKE_BINARY_DIR}
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
${SingleApplication_INCLUDE_DIR}
|
||||||
|
${plog_INCLUDE_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(gpclient
|
||||||
|
${SingleApplication_LIBRARY}
|
||||||
|
Qt5::Widgets
|
||||||
|
Qt5::Network
|
||||||
|
Qt5::WebSockets
|
||||||
|
Qt5::WebEngine
|
||||||
|
Qt5::WebEngineWidgets
|
||||||
|
Qt5::DBus
|
||||||
|
)
|
||||||
|
|
||||||
|
target_compile_definitions(gpclient PUBLIC QAPPLICATION_CLASS=QApplication)
|
||||||
|
|
||||||
|
install(TARGETS gpclient DESTINATION "/usr/bin")
|
||||||
|
install(FILES com.yuezk.qt.gpclient.desktop DESTINATION "/usr/share/applications")
|
||||||
|
install(FILES com.yuezk.qt.GPClient.svg DESTINATION "/usr/share/pixmaps")
|
@ -1,83 +0,0 @@
|
|||||||
TARGET = gpclient
|
|
||||||
|
|
||||||
QT += core gui network websockets dbus webenginewidgets
|
|
||||||
|
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
|
||||||
|
|
||||||
CONFIG += c++11
|
|
||||||
|
|
||||||
include(../singleapplication/singleapplication.pri)
|
|
||||||
DEFINES += QAPPLICATION_CLASS=QApplication
|
|
||||||
|
|
||||||
# The following define makes your compiler emit warnings if you use
|
|
||||||
# any Qt feature that has been marked deprecated (the exact warnings
|
|
||||||
# depend on your compiler). Please consult the documentation of the
|
|
||||||
# deprecated API in order to know how to port your code away from it.
|
|
||||||
DEFINES += QT_DEPRECATED_WARNINGS
|
|
||||||
|
|
||||||
INCLUDEPATH += ../plog/include
|
|
||||||
|
|
||||||
# You can also make your code fail to compile if it uses deprecated APIs.
|
|
||||||
# In order to do so, uncomment the following line.
|
|
||||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
|
||||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
|
||||||
SOURCES += \
|
|
||||||
cdpcommand.cpp \
|
|
||||||
cdpcommandmanager.cpp \
|
|
||||||
enhancedwebview.cpp \
|
|
||||||
gatewayauthenticator.cpp \
|
|
||||||
gatewayauthenticatorparams.cpp \
|
|
||||||
gpgateway.cpp \
|
|
||||||
gphelper.cpp \
|
|
||||||
loginparams.cpp \
|
|
||||||
main.cpp \
|
|
||||||
normalloginwindow.cpp \
|
|
||||||
portalauthenticator.cpp \
|
|
||||||
portalconfigresponse.cpp \
|
|
||||||
preloginresponse.cpp \
|
|
||||||
samlloginwindow.cpp \
|
|
||||||
gpclient.cpp \
|
|
||||||
settingsdialog.cpp
|
|
||||||
|
|
||||||
HEADERS += \
|
|
||||||
cdpcommand.h \
|
|
||||||
cdpcommandmanager.h \
|
|
||||||
enhancedwebview.h \
|
|
||||||
gatewayauthenticator.h \
|
|
||||||
gatewayauthenticatorparams.h \
|
|
||||||
gpgateway.h \
|
|
||||||
gphelper.h \
|
|
||||||
loginparams.h \
|
|
||||||
normalloginwindow.h \
|
|
||||||
portalauthenticator.h \
|
|
||||||
portalconfigresponse.h \
|
|
||||||
preloginresponse.h \
|
|
||||||
samlloginwindow.h \
|
|
||||||
gpclient.h \
|
|
||||||
settingsdialog.h
|
|
||||||
|
|
||||||
FORMS += \
|
|
||||||
gpclient.ui \
|
|
||||||
normalloginwindow.ui \
|
|
||||||
settingsdialog.ui
|
|
||||||
|
|
||||||
DBUS_INTERFACES += ../GPService/gpservice.xml
|
|
||||||
|
|
||||||
# Default rules for deployment.
|
|
||||||
target.path = /usr/bin
|
|
||||||
INSTALLS += target
|
|
||||||
|
|
||||||
DISTFILES += \
|
|
||||||
com.yuezk.qt.GPClient.svg \
|
|
||||||
com.yuezk.qt.gpclient.desktop
|
|
||||||
|
|
||||||
desktop_entry.path = /usr/share/applications/
|
|
||||||
desktop_entry.files = com.yuezk.qt.gpclient.desktop
|
|
||||||
|
|
||||||
desktop_icon.path = /usr/share/pixmaps/
|
|
||||||
desktop_icon.files = com.yuezk.qt.GPClient.svg
|
|
||||||
|
|
||||||
INSTALLS += desktop_entry desktop_icon
|
|
||||||
|
|
||||||
RESOURCES += \
|
|
||||||
resources.qrc
|
|
@ -1,8 +1,8 @@
|
|||||||
#include "cdpcommand.h"
|
#include <QtCore/QVariantMap>
|
||||||
|
#include <QtCore/QJsonDocument>
|
||||||
|
#include <QtCore/QJsonObject>
|
||||||
|
|
||||||
#include <QVariantMap>
|
#include "cdpcommand.h"
|
||||||
#include <QJsonDocument>
|
|
||||||
#include <QJsonObject>
|
|
||||||
|
|
||||||
CDPCommand::CDPCommand(QObject *parent) : QObject(parent)
|
CDPCommand::CDPCommand(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef CDPCOMMAND_H
|
#ifndef CDPCOMMAND_H
|
||||||
#define CDPCOMMAND_H
|
#define CDPCOMMAND_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QtCore/QObject>
|
||||||
|
|
||||||
class CDPCommand : public QObject
|
class CDPCommand : public QObject
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
#include "cdpcommandmanager.h"
|
#include <QtCore/QVariantMap>
|
||||||
#include <QVariantMap>
|
|
||||||
#include <plog/Log.h>
|
#include <plog/Log.h>
|
||||||
|
|
||||||
|
#include "cdpcommandmanager.h"
|
||||||
|
|
||||||
CDPCommandManager::CDPCommandManager(QObject *parent)
|
CDPCommandManager::CDPCommandManager(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, networkManager(new QNetworkAccessManager)
|
, networkManager(new QNetworkAccessManager)
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
#ifndef CDPCOMMANDMANAGER_H
|
#ifndef CDPCOMMANDMANAGER_H
|
||||||
#define CDPCOMMANDMANAGER_H
|
#define CDPCOMMANDMANAGER_H
|
||||||
|
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
#include <QtCore/QHash>
|
||||||
|
#include <QtWebSockets/QtWebSockets>
|
||||||
|
#include <QtNetwork/QNetworkAccessManager>
|
||||||
|
|
||||||
#include "cdpcommand.h"
|
#include "cdpcommand.h"
|
||||||
#include <QObject>
|
|
||||||
#include <QHash>
|
|
||||||
#include <QtWebSockets>
|
|
||||||
#include <QNetworkAccessManager>
|
|
||||||
|
|
||||||
class CDPCommandManager : public QObject
|
class CDPCommandManager : public QObject
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
|
#include <QtCore/QProcessEnvironment>
|
||||||
|
#include <QtWebEngineWidgets/QWebEngineView>
|
||||||
|
|
||||||
#include "enhancedwebview.h"
|
#include "enhancedwebview.h"
|
||||||
#include "cdpcommandmanager.h"
|
#include "cdpcommandmanager.h"
|
||||||
|
|
||||||
#include <QtWebEngineWidgets/QWebEngineView>
|
|
||||||
#include <QProcessEnvironment>
|
|
||||||
|
|
||||||
EnhancedWebView::EnhancedWebView(QWidget *parent)
|
EnhancedWebView::EnhancedWebView(QWidget *parent)
|
||||||
: QWebEngineView(parent)
|
: QWebEngineView(parent)
|
||||||
, cdp(new CDPCommandManager)
|
, cdp(new CDPCommandManager)
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
#ifndef ENHANCEDWEBVIEW_H
|
#ifndef ENHANCEDWEBVIEW_H
|
||||||
#define ENHANCEDWEBVIEW_H
|
#define ENHANCEDWEBVIEW_H
|
||||||
|
|
||||||
#include "cdpcommandmanager.h"
|
|
||||||
#include <QtWebEngineWidgets/QWebEngineView>
|
#include <QtWebEngineWidgets/QWebEngineView>
|
||||||
|
|
||||||
|
#include "cdpcommandmanager.h"
|
||||||
|
|
||||||
#define ENV_CDP_PORT "QTWEBENGINE_REMOTE_DEBUGGING"
|
#define ENV_CDP_PORT "QTWEBENGINE_REMOTE_DEBUGGING"
|
||||||
|
|
||||||
class EnhancedWebView : public QWebEngineView
|
class EnhancedWebView : public QWebEngineView
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
|
#include <QtNetwork/QNetworkReply>
|
||||||
|
#include <plog/Log.h>
|
||||||
|
|
||||||
#include "gatewayauthenticator.h"
|
#include "gatewayauthenticator.h"
|
||||||
#include "gphelper.h"
|
#include "gphelper.h"
|
||||||
#include "loginparams.h"
|
#include "loginparams.h"
|
||||||
#include "preloginresponse.h"
|
#include "preloginresponse.h"
|
||||||
|
|
||||||
#include <QNetworkReply>
|
|
||||||
#include <plog/Log.h>
|
|
||||||
|
|
||||||
using namespace gpclient::helper;
|
using namespace gpclient::helper;
|
||||||
|
|
||||||
GatewayAuthenticator::GatewayAuthenticator(const QString& gateway, const GatewayAuthenticatorParams params)
|
GatewayAuthenticator::GatewayAuthenticator(const QString& gateway, const GatewayAuthenticatorParams params)
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
#ifndef GATEWAYAUTHENTICATOR_H
|
#ifndef GATEWAYAUTHENTICATOR_H
|
||||||
#define GATEWAYAUTHENTICATOR_H
|
#define GATEWAYAUTHENTICATOR_H
|
||||||
|
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
|
||||||
#include "normalloginwindow.h"
|
#include "normalloginwindow.h"
|
||||||
#include "loginparams.h"
|
#include "loginparams.h"
|
||||||
#include "gatewayauthenticatorparams.h"
|
#include "gatewayauthenticatorparams.h"
|
||||||
#include <QObject>
|
|
||||||
|
|
||||||
class GatewayAuthenticator : public QObject
|
class GatewayAuthenticator : public QObject
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
#ifndef GATEWAYAUTHENTICATORPARAMS_H
|
#ifndef GATEWAYAUTHENTICATORPARAMS_H
|
||||||
#define GATEWAYAUTHENTICATORPARAMS_H
|
#define GATEWAYAUTHENTICATORPARAMS_H
|
||||||
|
|
||||||
#include <QString>
|
#include <QtCore/QString>
|
||||||
|
|
||||||
#include "portalconfigresponse.h"
|
#include "portalconfigresponse.h"
|
||||||
|
|
||||||
class GatewayAuthenticatorParams
|
class GatewayAuthenticatorParams
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
#include <QtGui/QIcon>
|
||||||
|
#include <plog/Log.h>
|
||||||
|
|
||||||
#include "gpclient.h"
|
#include "gpclient.h"
|
||||||
#include "gphelper.h"
|
#include "gphelper.h"
|
||||||
#include "ui_gpclient.h"
|
#include "ui_gpclient.h"
|
||||||
@ -6,9 +9,6 @@
|
|||||||
#include "settingsdialog.h"
|
#include "settingsdialog.h"
|
||||||
#include "gatewayauthenticatorparams.h"
|
#include "gatewayauthenticatorparams.h"
|
||||||
|
|
||||||
#include <plog/Log.h>
|
|
||||||
#include <QIcon>
|
|
||||||
|
|
||||||
using namespace gpclient::helper;
|
using namespace gpclient::helper;
|
||||||
|
|
||||||
GPClient::GPClient(QWidget *parent)
|
GPClient::GPClient(QWidget *parent)
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
#ifndef GPCLIENT_H
|
#ifndef GPCLIENT_H
|
||||||
#define GPCLIENT_H
|
#define GPCLIENT_H
|
||||||
|
|
||||||
#include "gpservice_interface.h"
|
#include <QtWidgets/QMainWindow>
|
||||||
|
#include <QtWidgets/QSystemTrayIcon>
|
||||||
|
#include <QtWidgets/QMenu>
|
||||||
|
#include <QtWidgets/QPushButton>
|
||||||
|
|
||||||
|
#include "gpserviceinterface.h"
|
||||||
#include "portalconfigresponse.h"
|
#include "portalconfigresponse.h"
|
||||||
#include "settingsdialog.h"
|
#include "settingsdialog.h"
|
||||||
|
|
||||||
#include <QMainWindow>
|
|
||||||
#include <QSystemTrayIcon>
|
|
||||||
#include <QMenu>
|
|
||||||
#include <QPushButton>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
namespace Ui { class GPClient; }
|
namespace Ui { class GPClient; }
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include "gpgateway.h"
|
#include <QtCore/QJsonObject>
|
||||||
|
#include <QtCore/QJsonDocument>
|
||||||
|
#include <QtCore/QJsonArray>
|
||||||
|
|
||||||
#include <QJsonObject>
|
#include "gpgateway.h"
|
||||||
#include <QJsonDocument>
|
|
||||||
#include <QJsonArray>
|
|
||||||
|
|
||||||
GPGateway::GPGateway()
|
GPGateway::GPGateway()
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#ifndef GPGATEWAY_H
|
#ifndef GPGATEWAY_H
|
||||||
#define GPGATEWAY_H
|
#define GPGATEWAY_H
|
||||||
|
|
||||||
#include <QString>
|
#include <QtCore/QString>
|
||||||
#include <QMap>
|
#include <QtCore/QMap>
|
||||||
#include <QJsonObject>
|
#include <QtCore/QJsonObject>
|
||||||
|
|
||||||
class GPGateway
|
class GPGateway
|
||||||
{
|
{
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
#include "gphelper.h"
|
#include <QtCore/QXmlStreamReader>
|
||||||
#include <QNetworkRequest>
|
#include <QtWidgets/QMessageBox>
|
||||||
#include <QXmlStreamReader>
|
#include <QtWidgets/QDesktopWidget>
|
||||||
#include <QMessageBox>
|
#include <QtWidgets/QApplication>
|
||||||
#include <QDesktopWidget>
|
#include <QtWidgets/QWidget>
|
||||||
#include <QApplication>
|
#include <QtNetwork/QNetworkRequest>
|
||||||
#include <QWidget>
|
#include <QtNetwork/QSslConfiguration>
|
||||||
#include <QSslConfiguration>
|
#include <QtNetwork/QSslSocket>
|
||||||
#include <QSslSocket>
|
|
||||||
#include <plog/Log.h>
|
#include <plog/Log.h>
|
||||||
|
|
||||||
|
#include "gphelper.h"
|
||||||
|
|
||||||
QNetworkAccessManager* gpclient::helper::networkManager = new QNetworkAccessManager;
|
QNetworkAccessManager* gpclient::helper::networkManager = new QNetworkAccessManager;
|
||||||
|
|
||||||
QNetworkReply* gpclient::helper::createRequest(QString url, QByteArray params)
|
QNetworkReply* gpclient::helper::createRequest(QString url, QByteArray params)
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
#ifndef GPHELPER_H
|
#ifndef GPHELPER_H
|
||||||
#define GPHELPER_H
|
#define GPHELPER_H
|
||||||
|
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
#include <QtCore/QUrlQuery>
|
||||||
|
#include <QtCore/QSettings>
|
||||||
|
#include <QtNetwork/QNetworkAccessManager>
|
||||||
|
#include <QtNetwork/QNetworkRequest>
|
||||||
|
#include <QtNetwork/QNetworkReply>
|
||||||
|
|
||||||
#include "samlloginwindow.h"
|
#include "samlloginwindow.h"
|
||||||
#include "gpgateway.h"
|
#include "gpgateway.h"
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QNetworkAccessManager>
|
|
||||||
#include <QNetworkRequest>
|
|
||||||
#include <QNetworkReply>
|
|
||||||
#include <QUrlQuery>
|
|
||||||
#include <QSettings>
|
|
||||||
|
|
||||||
|
|
||||||
const QString UA = "PAN GlobalProtect";
|
const QString UA = "PAN GlobalProtect";
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "loginparams.h"
|
#include <QtCore/QUrlQuery>
|
||||||
|
|
||||||
#include <QUrlQuery>
|
#include "loginparams.h"
|
||||||
|
|
||||||
LoginParams::LoginParams(const QString clientos)
|
LoginParams::LoginParams(const QString clientos)
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef LOGINPARAMS_H
|
#ifndef LOGINPARAMS_H
|
||||||
#define LOGINPARAMS_H
|
#define LOGINPARAMS_H
|
||||||
|
|
||||||
#include <QUrlQuery>
|
#include <QtCore/QUrlQuery>
|
||||||
|
|
||||||
class LoginParams
|
class LoginParams
|
||||||
{
|
{
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
#include "singleapplication.h"
|
#include <QtCore/QObject>
|
||||||
#include "gpclient.h"
|
#include <QtCore/QString>
|
||||||
#include "enhancedwebview.h"
|
#include <QtCore/QDir>
|
||||||
|
#include <QtCore/QStandardPaths>
|
||||||
#include <QStandardPaths>
|
|
||||||
#include <QProcessEnvironment>
|
|
||||||
#include <plog/Log.h>
|
#include <plog/Log.h>
|
||||||
#include <plog/Appenders/ColorConsoleAppender.h>
|
#include <plog/Appenders/ColorConsoleAppender.h>
|
||||||
|
|
||||||
static const QString version = "v1.3.3";
|
#include "singleapplication.h"
|
||||||
|
#include "gpclient.h"
|
||||||
|
#include "enhancedwebview.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@ -20,7 +21,7 @@ int main(int argc, char *argv[])
|
|||||||
static plog::ColorConsoleAppender<plog::TxtFormatter> consoleAppender;
|
static plog::ColorConsoleAppender<plog::TxtFormatter> consoleAppender;
|
||||||
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");
|
PLOGI << "PATH: " << qgetenv("PATH");
|
||||||
|
|
||||||
QString port = QString::fromLocal8Bit(qgetenv(ENV_CDP_PORT));
|
QString port = QString::fromLocal8Bit(qgetenv(ENV_CDP_PORT));
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
|
#include <QtGui/QCloseEvent>
|
||||||
|
|
||||||
#include "normalloginwindow.h"
|
#include "normalloginwindow.h"
|
||||||
#include "ui_normalloginwindow.h"
|
#include "ui_normalloginwindow.h"
|
||||||
|
|
||||||
#include <QCloseEvent>
|
|
||||||
|
|
||||||
NormalLoginWindow::NormalLoginWindow(QWidget *parent) :
|
NormalLoginWindow::NormalLoginWindow(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::NormalLoginWindow)
|
ui(new Ui::NormalLoginWindow)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef PORTALAUTHWINDOW_H
|
#ifndef PORTALAUTHWINDOW_H
|
||||||
#define PORTALAUTHWINDOW_H
|
#define PORTALAUTHWINDOW_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QtWidgets/QDialog>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class NormalLoginWindow;
|
class NormalLoginWindow;
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
#include <QtNetwork/QNetworkReply>
|
||||||
|
#include <plog/Log.h>
|
||||||
|
|
||||||
#include "portalauthenticator.h"
|
#include "portalauthenticator.h"
|
||||||
#include "gphelper.h"
|
#include "gphelper.h"
|
||||||
#include "normalloginwindow.h"
|
#include "normalloginwindow.h"
|
||||||
@ -7,9 +10,6 @@
|
|||||||
#include "portalconfigresponse.h"
|
#include "portalconfigresponse.h"
|
||||||
#include "gpgateway.h"
|
#include "gpgateway.h"
|
||||||
|
|
||||||
#include <plog/Log.h>
|
|
||||||
#include <QNetworkReply>
|
|
||||||
|
|
||||||
using namespace gpclient::helper;
|
using namespace gpclient::helper;
|
||||||
|
|
||||||
PortalAuthenticator::PortalAuthenticator(const QString& portal, const QString& clientos) : QObject()
|
PortalAuthenticator::PortalAuthenticator(const QString& portal, const QString& clientos) : QObject()
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
#ifndef PORTALAUTHENTICATOR_H
|
#ifndef PORTALAUTHENTICATOR_H
|
||||||
#define PORTALAUTHENTICATOR_H
|
#define PORTALAUTHENTICATOR_H
|
||||||
|
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
|
||||||
#include "portalconfigresponse.h"
|
#include "portalconfigresponse.h"
|
||||||
#include "normalloginwindow.h"
|
#include "normalloginwindow.h"
|
||||||
#include "samlloginwindow.h"
|
#include "samlloginwindow.h"
|
||||||
#include "preloginresponse.h"
|
#include "preloginresponse.h"
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
|
|
||||||
class PortalAuthenticator : public QObject
|
class PortalAuthenticator : public QObject
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include "portalconfigresponse.h"
|
#include <QtCore/QXmlStreamReader>
|
||||||
|
|
||||||
#include <QXmlStreamReader>
|
|
||||||
#include <plog/Log.h>
|
#include <plog/Log.h>
|
||||||
|
|
||||||
|
#include "portalconfigresponse.h"
|
||||||
|
|
||||||
QString PortalConfigResponse::xmlUserAuthCookie = "portal-userauthcookie";
|
QString PortalConfigResponse::xmlUserAuthCookie = "portal-userauthcookie";
|
||||||
QString PortalConfigResponse::xmlPrelogonUserAuthCookie = "portal-prelogonuserauthcookie";
|
QString PortalConfigResponse::xmlPrelogonUserAuthCookie = "portal-prelogonuserauthcookie";
|
||||||
QString PortalConfigResponse::xmlGateways = "gateways";
|
QString PortalConfigResponse::xmlGateways = "gateways";
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#ifndef PORTALCONFIGRESPONSE_H
|
#ifndef PORTALCONFIGRESPONSE_H
|
||||||
#define PORTALCONFIGRESPONSE_H
|
#define PORTALCONFIGRESPONSE_H
|
||||||
|
|
||||||
#include "gpgateway.h"
|
#include <QtCore/QString>
|
||||||
|
#include <QtCore/QList>
|
||||||
|
#include <QtCore/QXmlStreamReader>
|
||||||
|
|
||||||
#include <QString>
|
#include "gpgateway.h"
|
||||||
#include <QList>
|
|
||||||
#include <QXmlStreamReader>
|
|
||||||
|
|
||||||
class PortalConfigResponse
|
class PortalConfigResponse
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include "preloginresponse.h"
|
#include <QtCore/QXmlStreamReader>
|
||||||
|
#include <QtCore/QMap>
|
||||||
#include <QXmlStreamReader>
|
|
||||||
#include <QMap>
|
|
||||||
#include <plog/Log.h>
|
#include <plog/Log.h>
|
||||||
|
|
||||||
|
#include "preloginresponse.h"
|
||||||
|
|
||||||
QString PreloginResponse::xmlAuthMessage = "authentication-message";
|
QString PreloginResponse::xmlAuthMessage = "authentication-message";
|
||||||
QString PreloginResponse::xmlLabelUsername = "username-label";
|
QString PreloginResponse::xmlLabelUsername = "username-label";
|
||||||
QString PreloginResponse::xmlLabelPassword = "password-label";
|
QString PreloginResponse::xmlLabelPassword = "password-label";
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#ifndef PRELOGINRESPONSE_H
|
#ifndef PRELOGINRESPONSE_H
|
||||||
#define PRELOGINRESPONSE_H
|
#define PRELOGINRESPONSE_H
|
||||||
|
|
||||||
#include <QString>
|
#include <QtCore/QString>
|
||||||
#include <QMap>
|
#include <QtCore/QMap>
|
||||||
|
|
||||||
class PreloginResponse
|
class PreloginResponse
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include "samlloginwindow.h"
|
#include <QtWidgets/QVBoxLayout>
|
||||||
|
#include <QtWebEngineWidgets/QWebEngineProfile>
|
||||||
#include <QVBoxLayout>
|
#include <QtWebEngineWidgets/QWebEngineView>
|
||||||
#include <plog/Log.h>
|
#include <plog/Log.h>
|
||||||
#include <QWebEngineProfile>
|
|
||||||
#include <QWebEngineView>
|
#include "samlloginwindow.h"
|
||||||
|
|
||||||
SAMLLoginWindow::SAMLLoginWindow(QWidget *parent)
|
SAMLLoginWindow::SAMLLoginWindow(QWidget *parent)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#ifndef SAMLLOGINWINDOW_H
|
#ifndef SAMLLOGINWINDOW_H
|
||||||
#define SAMLLOGINWINDOW_H
|
#define SAMLLOGINWINDOW_H
|
||||||
|
|
||||||
#include "enhancedwebview.h"
|
#include <QtCore/QMap>
|
||||||
|
#include <QtGui/QCloseEvent>
|
||||||
|
#include <QtWidgets/QDialog>
|
||||||
|
|
||||||
#include <QDialog>
|
#include "enhancedwebview.h"
|
||||||
#include <QMap>
|
|
||||||
#include <QCloseEvent>
|
|
||||||
|
|
||||||
class SAMLLoginWindow : public QDialog
|
class SAMLLoginWindow : public QDialog
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef SETTINGSDIALOG_H
|
#ifndef SETTINGSDIALOG_H
|
||||||
#define SETTINGSDIALOG_H
|
#define SETTINGSDIALOG_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QtWidgets/QDialog>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class SettingsDialog;
|
class SettingsDialog;
|
||||||
|
57
GPService/CMakeLists.txt
Normal file
57
GPService/CMakeLists.txt
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
include("${CMAKE_SOURCE_DIR}/cmake/Add3rdParty.cmake")
|
||||||
|
|
||||||
|
project(GPService)
|
||||||
|
|
||||||
|
set(gpservice_GENERATED_SOURCES)
|
||||||
|
|
||||||
|
# generate the dbus xml definition
|
||||||
|
qt5_generate_dbus_interface(gpservice.h ${CMAKE_BINARY_DIR}/com.yuezk.qt.GPService.xml)
|
||||||
|
|
||||||
|
# generate dbus adaptor
|
||||||
|
qt5_add_dbus_adaptor(
|
||||||
|
gpservice_GENERATED_SOURCES
|
||||||
|
${CMAKE_BINARY_DIR}/com.yuezk.qt.GPService.xml
|
||||||
|
gpservice.h
|
||||||
|
GPService
|
||||||
|
)
|
||||||
|
|
||||||
|
add_executable(gpservice
|
||||||
|
gpservice.cpp
|
||||||
|
main.cpp
|
||||||
|
sigwatch.cpp
|
||||||
|
${gpservice_GENERATED_SOURCES}
|
||||||
|
)
|
||||||
|
|
||||||
|
add_3rdparty(
|
||||||
|
SingleApplication
|
||||||
|
GIT_REPOSITORY https://github.com/itay-grudev/SingleApplication.git
|
||||||
|
GIT_TAG v3.3.0
|
||||||
|
CMAKE_ARGS -DQAPPLICATION_CLASS=QCoreApplication
|
||||||
|
)
|
||||||
|
|
||||||
|
ExternalProject_Get_Property(SingleApplication-${PROJECT_NAME} SOURCE_DIR BINARY_DIR)
|
||||||
|
|
||||||
|
set(SingleApplication_INCLUDE_DIR ${SOURCE_DIR})
|
||||||
|
set(SingleApplication_LIBRARY ${BINARY_DIR}/libSingleApplication.a)
|
||||||
|
|
||||||
|
add_dependencies(gpservice SingleApplication-${PROJECT_NAME})
|
||||||
|
|
||||||
|
target_include_directories(gpservice PRIVATE
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
${SingleApplication_INCLUDE_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(gpservice
|
||||||
|
${SingleApplication_LIBRARY}
|
||||||
|
Qt5::Core
|
||||||
|
Qt5::Network
|
||||||
|
Qt5::DBus
|
||||||
|
)
|
||||||
|
|
||||||
|
target_compile_definitions(gpservice PUBLIC QAPPLICATION_CLASS=QCoreApplication)
|
||||||
|
|
||||||
|
install(TARGETS gpservice DESTINATION "/usr/bin")
|
||||||
|
install(FILES "dbus/com.yuezk.qt.GPService.conf" DESTINATION "/usr/share/dbus-1/system.d" )
|
||||||
|
install(FILES "dbus/com.yuezk.qt.GPService.service" DESTINATION "/usr/share/dbus-1/system-services")
|
||||||
|
install(FILES "systemd/gpservice.service" DESTINATION "/etc/systemd/system")
|
@ -1,52 +0,0 @@
|
|||||||
TARGET = gpservice
|
|
||||||
|
|
||||||
#QT += dbus
|
|
||||||
QT -= gui
|
|
||||||
|
|
||||||
CONFIG += c++11 console
|
|
||||||
CONFIG -= app_bundle
|
|
||||||
|
|
||||||
include(../singleapplication/singleapplication.pri)
|
|
||||||
DEFINES += QAPPLICATION_CLASS=QCoreApplication
|
|
||||||
|
|
||||||
# The following define makes your compiler emit warnings if you use
|
|
||||||
# any Qt feature that has been marked deprecated (the exact warnings
|
|
||||||
# depend on your compiler). Please consult the documentation of the
|
|
||||||
# deprecated API in order to know how to port your code away from it.
|
|
||||||
DEFINES += QT_DEPRECATED_WARNINGS
|
|
||||||
|
|
||||||
# You can also make your code fail to compile if it uses deprecated APIs.
|
|
||||||
# In order to do so, uncomment the following line.
|
|
||||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
|
||||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
|
||||||
|
|
||||||
HEADERS += \
|
|
||||||
# gpservice.h \
|
|
||||||
sigwatch.h
|
|
||||||
|
|
||||||
SOURCES += \
|
|
||||||
# gpservice.cpp \
|
|
||||||
main.cpp \
|
|
||||||
sigwatch.cpp
|
|
||||||
|
|
||||||
#DBUS_ADAPTORS += gpservice.xml
|
|
||||||
|
|
||||||
# Default rules for deployment.
|
|
||||||
target.path = /usr/bin
|
|
||||||
INSTALLS += target
|
|
||||||
|
|
||||||
#DISTFILES += \
|
|
||||||
# dbus/com.yuezk.qt.GPService.conf \
|
|
||||||
# dbus/com.yuezk.qt.GPService.service \
|
|
||||||
# systemd/gpservice.service
|
|
||||||
|
|
||||||
#dbus_config.path = /usr/share/dbus-1/system.d/
|
|
||||||
#dbus_config.files = dbus/com.yuezk.qt.GPService.conf
|
|
||||||
|
|
||||||
#dbus_service.path = /usr/share/dbus-1/system-services/
|
|
||||||
#dbus_service.files = dbus/com.yuezk.qt.GPService.service
|
|
||||||
|
|
||||||
#systemd_service.path = /etc/systemd/system/
|
|
||||||
#systemd_service.files = systemd/gpservice.service
|
|
||||||
|
|
||||||
#INSTALLS += dbus_config dbus_service systemd_service
|
|
@ -1,11 +1,13 @@
|
|||||||
#include "gpservice.h"
|
#include <QtCore/QFileInfo>
|
||||||
#include "gpservice_adaptor.h"
|
#include <QtCore/QDateTime>
|
||||||
|
#include <QtCore/QVariant>
|
||||||
|
#include <QtCore/QRegularExpression>
|
||||||
|
#include <QtCore/QRegularExpressionMatch>
|
||||||
|
#include <QtDBus/QtDBus>
|
||||||
|
#include <QtCore/QProcessEnvironment>
|
||||||
|
|
||||||
#include <QFileInfo>
|
#include "gpservice.h"
|
||||||
#include <QtDBus>
|
#include "gpserviceadaptor.h"
|
||||||
#include <QDateTime>
|
|
||||||
#include <QVariant>
|
|
||||||
#include <QProcessEnvironment>
|
|
||||||
|
|
||||||
GPService::GPService(QObject *parent)
|
GPService::GPService(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
@ -107,6 +109,10 @@ void GPService::connect(QString server, QString username, QString passwd, QStrin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isValidVersion(bin)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QStringList args;
|
QStringList args;
|
||||||
args << QCoreApplication::arguments().mid(1)
|
args << QCoreApplication::arguments().mid(1)
|
||||||
<< "--protocol=gp"
|
<< "--protocol=gp"
|
||||||
@ -122,6 +128,32 @@ void GPService::connect(QString server, QString username, QString passwd, QStrin
|
|||||||
openconnect->start(bin, args);
|
openconnect->start(bin, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GPService::isValidVersion(QString &bin) {
|
||||||
|
QProcess p;
|
||||||
|
p.start(bin, QStringList("--version"));
|
||||||
|
p.waitForFinished();
|
||||||
|
QString output = p.readAllStandardError() + p.readAllStandardOutput();
|
||||||
|
|
||||||
|
QRegularExpression re("v(\\d+).*?(\\s|\\n)");
|
||||||
|
QRegularExpressionMatch match = re.match(output);
|
||||||
|
|
||||||
|
if (match.hasMatch()) {
|
||||||
|
log("Output of `openconnect --version`: " + output);
|
||||||
|
|
||||||
|
QString fullVersion = match.captured(0);
|
||||||
|
QString majorVersion = match.captured(1);
|
||||||
|
|
||||||
|
if (majorVersion.toInt() < 8) {
|
||||||
|
emit error("The OpenConnect version must greater than v8.0.0, but got " + fullVersion);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log("Failed to parse the OpenConnect version from " + output);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void GPService::disconnect()
|
void GPService::disconnect()
|
||||||
{
|
{
|
||||||
if (openconnect->state() != QProcess::NotRunning) {
|
if (openconnect->state() != QProcess::NotRunning) {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#ifndef GLOBALPROTECTSERVICE_H
|
#ifndef GLOBALPROTECTSERVICE_H
|
||||||
#define GLOBALPROTECTSERVICE_H
|
#define GLOBALPROTECTSERVICE_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QProcess>
|
#include <QtCore/QProcess>
|
||||||
|
|
||||||
static const QString binaryPaths[] {
|
static const QString binaryPaths[] {
|
||||||
"/usr/local/bin/openconnect",
|
"/usr/local/bin/openconnect",
|
||||||
@ -21,6 +21,8 @@ public:
|
|||||||
explicit GPService(QObject *parent = nullptr);
|
explicit GPService(QObject *parent = nullptr);
|
||||||
~GPService();
|
~GPService();
|
||||||
|
|
||||||
|
void quit();
|
||||||
|
|
||||||
enum VpnStatus {
|
enum VpnStatus {
|
||||||
VpnNotConnected,
|
VpnNotConnected,
|
||||||
VpnConnecting,
|
VpnConnecting,
|
||||||
@ -38,7 +40,6 @@ public slots:
|
|||||||
void connect(QString server, QString username, QString passwd, QString extraArgs);
|
void connect(QString server, QString username, QString passwd, QString extraArgs);
|
||||||
void disconnect();
|
void disconnect();
|
||||||
int status();
|
int status();
|
||||||
void quit();
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onProcessStarted();
|
void onProcessStarted();
|
||||||
@ -53,6 +54,7 @@ private:
|
|||||||
int vpnStatus = GPService::VpnNotConnected;
|
int vpnStatus = GPService::VpnNotConnected;
|
||||||
|
|
||||||
void log(QString msg);
|
void log(QString msg);
|
||||||
|
bool isValidVersion(QString &bin);
|
||||||
static QString findBinary();
|
static QString findBinary();
|
||||||
static QStringList splitCommand(QString command);
|
static QStringList splitCommand(QString command);
|
||||||
};
|
};
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
|
||||||
<node>
|
|
||||||
<interface name="com.yuezk.qt.GPService">
|
|
||||||
<signal name="connected">
|
|
||||||
</signal>
|
|
||||||
<signal name="disconnected">
|
|
||||||
</signal>
|
|
||||||
<signal name="logAvailable">
|
|
||||||
<arg name="log" type="s" />
|
|
||||||
</signal>
|
|
||||||
<signal name="error">
|
|
||||||
<arg name="errorMessage" type="s" />
|
|
||||||
</signal>
|
|
||||||
<method name="connect">
|
|
||||||
<arg name="server" type="s" direction="in"/>
|
|
||||||
<arg name="username" type="s" direction="in"/>
|
|
||||||
<arg name="passwd" type="s" direction="in"/>
|
|
||||||
<arg name="extraArgs" type="s" direction="in"/>
|
|
||||||
</method>
|
|
||||||
<method name="disconnect">
|
|
||||||
</method>
|
|
||||||
<method name="status">
|
|
||||||
<arg type="i" direction="out"/>
|
|
||||||
</method>
|
|
||||||
</interface>
|
|
||||||
</node>
|
|
@ -1,23 +1,23 @@
|
|||||||
//#include "gpservice.h"
|
#include <iostream>
|
||||||
|
#include <QtDBus/QtDBus>
|
||||||
|
#include <QtCore/QProcessEnvironment>
|
||||||
|
|
||||||
|
#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"
|
{
|
||||||
// "Please check your system settings and try again.\n");
|
qWarning("Cannot connect to the D-Bus session bus.\n"
|
||||||
// return 1;
|
"Please check your system settings and try again.\n");
|
||||||
// }
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// GPService service;
|
GPService service;
|
||||||
|
|
||||||
QString env = "ENV: " + QProcessEnvironment::systemEnvironment().toStringList().join("\n");
|
QString env = "ENV: " + QProcessEnvironment::systemEnvironment().toStringList().join("\n");
|
||||||
std::cout << env.toStdString();
|
std::cout << env.toStdString();
|
||||||
@ -27,7 +27,7 @@ int main(int argc, char *argv[])
|
|||||||
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();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
TEMPLATE = subdirs
|
|
||||||
|
|
||||||
SUBDIRS += \
|
|
||||||
GPClient \
|
|
||||||
GPService
|
|
@ -9,31 +9,25 @@ arch=(x86_64 aarch64)
|
|||||||
url="https://github.com/yuezk/${_gitname}"
|
url="https://github.com/yuezk/${_gitname}"
|
||||||
license=('GPL3')
|
license=('GPL3')
|
||||||
depends=('openconnect>=8.0.0' qt5-base qt5-webengine qt5-websockets)
|
depends=('openconnect>=8.0.0' qt5-base qt5-webengine qt5-websockets)
|
||||||
makedepends=()
|
makedepends=(g++ make)
|
||||||
source=(
|
source=(
|
||||||
"${_gitname}-${pkgver}.tar.gz::${url}/archive/v${pkgver}.tar.gz"
|
"${_gitname}-${pkgver}.tar.gz::${url}/archive/v${pkgver}.tar.gz"
|
||||||
"https://github.com/itay-grudev/SingleApplication/archive/v3.0.19.tar.gz"
|
|
||||||
"https://github.com/SergiusTheBest/plog/archive/1.1.5.tar.gz"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
sha256sums=(
|
sha256sums=(
|
||||||
'{SOURCE_SHA}'
|
'{SOURCE_SHA}'
|
||||||
'9405fd259288b2a862e91e5135bccee936f0438e1b32c13603277132309d15e0'
|
|
||||||
'6c80b4701183d2415bec927e1f5ca9b1761b3b5c65d3e09fb29c743e016d5609'
|
|
||||||
);
|
);
|
||||||
|
|
||||||
prepare() {
|
prepare() {
|
||||||
mv "$srcdir/SingleApplication-3.0.19" -T "$srcdir/${_gitname}-${pkgver}/singleapplication"
|
|
||||||
mv "$srcdir/plog-1.1.5" -T "$srcdir/${_gitname}-${pkgver}/plog"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
cd "$srcdir/${_gitname}-${pkgver}"
|
cd "$srcdir/${_gitname}-${pkgver}"
|
||||||
qmake CONFIG+=release "${srcdir}/${_gitname}-${pkgver}/GlobalProtect-openconnect.pro"
|
./cmakew -B build
|
||||||
make
|
MAKEFLAGS=-j$(nproc) ./cmakew --build build
|
||||||
}
|
}
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
cd "$srcdir/${_gitname}-${pkgver}"
|
cd "$srcdir/${_gitname}-${pkgver}"
|
||||||
make INSTALL_ROOT="$pkgdir/" install
|
make DESTDIR="$pkgdir/" install -C build
|
||||||
}
|
}
|
||||||
|
104
README.md
104
README.md
@ -2,7 +2,7 @@
|
|||||||
A GlobalProtect VPN client (GUI) for Linux based on Openconnect and built with Qt5, supports SAML auth mode, inspired by [gp-saml-gui](https://github.com/dlenski/gp-saml-gui).
|
A GlobalProtect VPN client (GUI) for Linux based on Openconnect and built with Qt5, supports SAML auth mode, inspired by [gp-saml-gui](https://github.com/dlenski/gp-saml-gui).
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="screenshot.png">
|
<img src="https://user-images.githubusercontent.com/3297602/133869036-5c02b0d9-c2d9-4f87-8c81-e44f68cfd6ac.png">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
@ -43,63 +43,63 @@ Install the [AppIndicator and KStatusNotifierItem Support](https://extensions.gn
|
|||||||
- Openconnect v8.x
|
- Openconnect v8.x
|
||||||
- Qt5, qt5-webengine, qt5-websockets
|
- Qt5, qt5-webengine, qt5-websockets
|
||||||
|
|
||||||
### Ubuntu
|
## Build & Install
|
||||||
1. Install openconnect v8.x
|
|
||||||
|
|
||||||
```sh
|
Clone this repo with:
|
||||||
sudo apt install openconnect
|
|
||||||
openconnect --version
|
|
||||||
```
|
|
||||||
|
|
||||||
For Ubuntu 18.04 you might need to [build the latest openconnect from source code](https://gist.github.com/yuezk/ab9a4b87a9fa0182bdb2df41fab5f613).
|
|
||||||
|
|
||||||
2. Install the Qt dependencies
|
|
||||||
|
|
||||||
For Ubuntu 20, this should work.
|
|
||||||
|
|
||||||
```sh
|
|
||||||
sudo apt install qtbase5-dev libqt5websockets5-dev qtwebengine5-dev qttools5-dev debhelper
|
|
||||||
```
|
|
||||||
|
|
||||||
For Ubuntu 21, you need to install the base pieces separately as QT5 is the default.
|
|
||||||
|
|
||||||
```sh
|
|
||||||
sudo apt install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libqt5websockets5-dev qtwebengine5-dev qttools5-dev debhelper
|
|
||||||
```
|
|
||||||
|
|
||||||
### OpenSUSE
|
|
||||||
Install the Qt dependencies
|
|
||||||
|
|
||||||
```sh
|
|
||||||
sudo zypper install libqt5-qtbase-devel libqt5-qtwebsockets-devel libqt5-qtwebengine-devel
|
|
||||||
```
|
|
||||||
|
|
||||||
### Fedora
|
|
||||||
Install the Qt dependencies:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
sudo dnf install qt5-qtbase-devel qt5-qtwebengine-devel qt5-qtwebsockets-devel
|
|
||||||
```
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
### Install from AUR (Arch/Manjaro)
|
|
||||||
|
|
||||||
Install [globalprotect-openconnect](https://aur.archlinux.org/packages/globalprotect-openconnect/).
|
|
||||||
|
|
||||||
### Build from source code
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone https://github.com/yuezk/GlobalProtect-openconnect.git
|
git clone https://github.com/yuezk/GlobalProtect-openconnect.git
|
||||||
cd GlobalProtect-openconnect
|
cd GlobalProtect-openconnect
|
||||||
git submodule update --init
|
|
||||||
|
|
||||||
# qmake or qmake-qt5
|
|
||||||
qmake CONFIG+=release
|
|
||||||
make
|
|
||||||
sudo make install
|
|
||||||
```
|
```
|
||||||
Open `GlobalProtect VPN` in the application dashboard.
|
|
||||||
|
### Arch/Manjaro
|
||||||
|
|
||||||
|
Install from the [globalprotect-openconnect](https://aur.archlinux.org/packages/globalprotect-openconnect/) AUR.
|
||||||
|
|
||||||
|
### Ubuntu/Mint
|
||||||
|
|
||||||
|
For **Ubuntu 18.04**, add this [dwmw2/openconnect](https://launchpad.net/~dwmw2/+archive/ubuntu/openconnect) PPA first to install the latest openconnect.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo add-apt-repository ppa:dwmw2/openconnect
|
||||||
|
sudo apt update
|
||||||
|
```
|
||||||
|
...then build and install with:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
./scripts/install-ubuntu.sh
|
||||||
|
```
|
||||||
|
### openSUSE
|
||||||
|
|
||||||
|
Build and install with:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
./scripts/install-opensuse.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
### Fedora
|
||||||
|
|
||||||
|
Build and install with:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
./scripts/install-fedora.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
### Other Linux
|
||||||
|
|
||||||
|
Install the Qt5 dependencies and OpenConnect:
|
||||||
|
|
||||||
|
- QtCore
|
||||||
|
- QtWebEngine
|
||||||
|
- QtWebSockets
|
||||||
|
- QtDBus
|
||||||
|
- openconnect v8.x
|
||||||
|
|
||||||
|
...then build and install with:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
./scripts/install.sh
|
||||||
|
```
|
||||||
|
|
||||||
### Debian package
|
### Debian package
|
||||||
|
|
||||||
|
27
cmake/Add3rdParty.cmake
Normal file
27
cmake/Add3rdParty.cmake
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
include(ExternalProject)
|
||||||
|
|
||||||
|
function(add_3rdparty NAME)
|
||||||
|
set(oneValueArgs GIT_REPOSITORY GIT_TAG)
|
||||||
|
cmake_parse_arguments(add_3rdparty_args "" "${oneValueArgs}" "" ${ARGN})
|
||||||
|
|
||||||
|
if(EXISTS "${CMAKE_SOURCE_DIR}/3rdparty/${NAME}/CMakeLists.txt")
|
||||||
|
message(STATUS "Found third party locally for ${NAME}")
|
||||||
|
|
||||||
|
ExternalProject_Add(
|
||||||
|
${NAME}-${PROJECT_NAME}
|
||||||
|
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/${NAME}
|
||||||
|
SOURCE_DIR "${CMAKE_SOURCE_DIR}/3rdparty/${NAME}"
|
||||||
|
INSTALL_COMMAND ""
|
||||||
|
"${add_3rdparty_args_UNPARSED_ARGUMENTS}"
|
||||||
|
)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message(STATUS "Using ExternalProject to download ${NAME}")
|
||||||
|
ExternalProject_Add(
|
||||||
|
${NAME}-${PROJECT_NAME}
|
||||||
|
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/${NAME}
|
||||||
|
INSTALL_COMMAND ""
|
||||||
|
"${ARGN}"
|
||||||
|
)
|
||||||
|
endfunction()
|
102
cmakew
Executable file
102
cmakew
Executable file
@ -0,0 +1,102 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cmake_version="3.21.2"
|
||||||
|
|
||||||
|
arr_cmake_v=(${cmake_version//./ })
|
||||||
|
cmake_version_major=(${arr_cmake_v[0]})
|
||||||
|
cmake_version_minor=(${arr_cmake_v[1]})
|
||||||
|
cmake_version_patch=(${arr_cmake_v[2]})
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
NONSTOP* )
|
||||||
|
nonstop=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||||
|
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cmake_base="./.cmake"
|
||||||
|
cmake_bin="${cmake_base}/cmake-$cmake_version/bin/cmake"
|
||||||
|
|
||||||
|
# download cmake if neccessary
|
||||||
|
if [ ! -f "$cmake_bin" ]; then
|
||||||
|
download_link=""
|
||||||
|
|
||||||
|
if [ "$darwin" = true ]; then
|
||||||
|
download_link="https://cmake.org/files/v$cmake_version_major.$cmake_version_minor/cmake-$cmake_version-Darwin-x86_64.tar.gz"
|
||||||
|
else
|
||||||
|
download_link="https://github.com/Kitware/CMake/releases/download/v${cmake_version}/cmake-${cmake_version}-linux-x86_64.tar.gz"
|
||||||
|
fi
|
||||||
|
|
||||||
|
wget -nv --show-progress "$download_link" -O "/tmp/cmake-$cmake_version.tar.gz"
|
||||||
|
mkdir -p "${cmake_base}/cmake-$cmake_version"
|
||||||
|
tar -xzf "/tmp/cmake-$cmake_version.tar.gz" -C "${cmake_base}/cmake-$cmake_version" --strip-components=1
|
||||||
|
rm "/tmp/cmake-$cmake_version.tar.gz"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
if [ "$cygwin" = true ]; then
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
i=$((i+1))
|
||||||
|
done
|
||||||
|
|
||||||
|
case $i in
|
||||||
|
(0) set -- ;;
|
||||||
|
(1) set -- "$args0" ;;
|
||||||
|
(2) set -- "$args0" "$args1" ;;
|
||||||
|
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# run cmake
|
||||||
|
exec "$cmake_bin" "$@"
|
1
plog
1
plog
@ -1 +0,0 @@
|
|||||||
Subproject commit fda4a26c26b2d1b2beb68d7b92b56950ec2b8ad2
|
|
BIN
screenshot.png
BIN
screenshot.png
Binary file not shown.
Before Width: | Height: | Size: 24 KiB |
452
scripts/bump-version.sh
Executable file
452
scripts/bump-version.sh
Executable file
@ -0,0 +1,452 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# █▄▄ █░█ █▀▄▀█ █▀█ ▄▄ █░█ █▀▀ █▀█ █▀ █ █▀█ █▄░█
|
||||||
|
# █▄█ █▄█ █░▀░█ █▀▀ ░░ ▀▄▀ ██▄ █▀▄ ▄█ █ █▄█ █░▀█
|
||||||
|
#
|
||||||
|
# Description:
|
||||||
|
# - This script automates bumping the git software project's version using automation.
|
||||||
|
|
||||||
|
# - It does several things that are typically required for releasing a Git repository, like git tagging,
|
||||||
|
# automatic updating of CHANGELOG.md, and incrementing the version number in various JSON files.
|
||||||
|
|
||||||
|
# - Increments / suggests the current software project's version number
|
||||||
|
# - Adds a Git tag, named after the chosen version number
|
||||||
|
# - Updates CHANGELOG.md
|
||||||
|
# - Updates VERSION file
|
||||||
|
# - Commits files to a new branch
|
||||||
|
# - Pushes to remote (optionally)
|
||||||
|
# - Updates "version" : "x.x.x" tag in JSON files if [-v file1 -v file2...] argument is supplied.
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# ./bump-version.sh [-v <version number>] [-m <release message>] [-j <file1>] [-j <file2>].. [-n] [-p] [-b] [-h]
|
||||||
|
#
|
||||||
|
# Options:
|
||||||
|
# -v <version number> Specify a manual version number
|
||||||
|
# -m <release message> Custom release message.
|
||||||
|
# -f <filename.json> Update version number inside JSON files.
|
||||||
|
# * For multiple files, add a separate -f option for each one,
|
||||||
|
# * For example: ./bump-version.sh -f src/plugin/package.json -f composer.json
|
||||||
|
# -p <repository alias> Push commits to remote repository, eg `-p origin`
|
||||||
|
# -n Don't perform a commit automatically.
|
||||||
|
# * You may want to do that yourself, for example.
|
||||||
|
# -b Don't create automatic `release-<version>` branch
|
||||||
|
# -h Show help message.
|
||||||
|
|
||||||
|
#
|
||||||
|
# Detailed notes:
|
||||||
|
# – The contents of the `VERSION` file which should be a semantic version number such as "1.2.3"
|
||||||
|
# or even "1.2.3-beta+001.ab"
|
||||||
|
#
|
||||||
|
# – It pulls a list of changes from git history & prepends to a file called CHANGELOG.md
|
||||||
|
# under the title of the new version # number, allows the user to review and update the changelist
|
||||||
|
#
|
||||||
|
# – Creates a Git tag with the version number
|
||||||
|
#
|
||||||
|
# - Creates automatic `release-<version>` branch
|
||||||
|
#
|
||||||
|
# – Commits the new version to the current repository
|
||||||
|
#
|
||||||
|
# – Optionally pushes the commit to remote repository
|
||||||
|
#
|
||||||
|
# – Make sure to set execute permissions for the script, eg `$ chmod 755 bump-version.sh`
|
||||||
|
#
|
||||||
|
# Credits:
|
||||||
|
# – https://github.com/jv-k/bump-version
|
||||||
|
#
|
||||||
|
# - Inspired by the scripts from @pete-otaqui and @mareksuscak
|
||||||
|
# https://gist.github.com/pete-otaqui/4188238
|
||||||
|
# https://gist.github.com/mareksuscak/1f206fbc3bb9d97dec9c
|
||||||
|
#
|
||||||
|
|
||||||
|
NOW="$(date +'%B %d, %Y')"
|
||||||
|
|
||||||
|
# ANSI/VT100 colours
|
||||||
|
YELLOW='\033[1;33m'
|
||||||
|
LIGHTYELLOW='\033[0;33m'
|
||||||
|
RED='\033[0;31m'
|
||||||
|
LIGHTRED='\033[1;31m'
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
LIGHTGREEN='\033[1;32m'
|
||||||
|
BLUE='\033[0;34m'
|
||||||
|
LIGHTBLUE='\033[1;34m'
|
||||||
|
PURPLE='\033[0;35m'
|
||||||
|
LIGHTPURPLE='\033[1;35m'
|
||||||
|
CYAN='\033[0;36m'
|
||||||
|
LIGHTCYAN='\033[1;36m'
|
||||||
|
WHITE='\033[1;37m'
|
||||||
|
LIGHTGRAY='\033[0;37m'
|
||||||
|
DARKGRAY='\033[1;30m'
|
||||||
|
BOLD="\033[1m"
|
||||||
|
INVERT="\033[7m"
|
||||||
|
RESET='\033[0m'
|
||||||
|
|
||||||
|
# Default options
|
||||||
|
FLAG_JSON="false"
|
||||||
|
FLAG_PUSH="false"
|
||||||
|
|
||||||
|
I_OK="✅"; I_STOP="🚫"; I_ERROR="❌"; I_END="👋🏻"
|
||||||
|
|
||||||
|
S_NORM="${WHITE}"
|
||||||
|
S_LIGHT="${LIGHTGRAY}"
|
||||||
|
S_NOTICE="${GREEN}"
|
||||||
|
S_QUESTION="${YELLOW}"
|
||||||
|
S_WARN="${LIGHTRED}"
|
||||||
|
S_ERROR="${RED}"
|
||||||
|
|
||||||
|
V_SUGGEST="0.1.0" # This is suggested in case VERSION file or user supplied version via -v is missing
|
||||||
|
GIT_MSG=""
|
||||||
|
REL_NOTE=""
|
||||||
|
REL_PREFIX="release-"
|
||||||
|
PUSH_DEST="origin"
|
||||||
|
|
||||||
|
# Show credits & help
|
||||||
|
usage() {
|
||||||
|
echo -e "$GREEN"\
|
||||||
|
"\n █▄▄ █░█ █▀▄▀█ █▀█ ▄▄ █░█ █▀▀ █▀█ █▀ █ █▀█ █▄░█ "\
|
||||||
|
"\n █▄█ █▄█ █░▀░█ █▀▀ ░░ ▀▄▀ ██▄ █▀▄ ▄█ █ █▄█ █░▀█ "\
|
||||||
|
"\n\t\t\t\t\t$LIGHTGRAY v${SCRIPT_VER}"\
|
||||||
|
|
||||||
|
echo -e " ${S_NORM}${BOLD}Usage:${RESET}"\
|
||||||
|
"\n $0 [-v <version number>] [-m <release message>] [-j <file1>] [-j <file2>].. [-n] [-p] [-h]" 1>&2;
|
||||||
|
|
||||||
|
echo -e "\n ${S_NORM}${BOLD}Options:${RESET}"
|
||||||
|
echo -e " $S_WARN-v$S_NORM <version number>\tSpecify a manual version number"
|
||||||
|
echo -e " $S_WARN-m$S_NORM <release message>\tCustom release message."
|
||||||
|
echo -e " $S_WARN-f$S_NORM <filename.json>\tUpdate version number inside JSON files."\
|
||||||
|
"\n\t\t\t* For multiple files, add a separate -f option for each one,"\
|
||||||
|
"\n\t\t\t* For example: ./bump-version.sh -f src/plugin/package.json -f composer.json"
|
||||||
|
echo -e " $S_WARN-p$S_NORM \t\t\tPush commits to ORIGIN. "
|
||||||
|
echo -e " $S_WARN-n$S_NORM \t\t\tDon't perform a commit automatically. "\
|
||||||
|
"\n\t\t\t* You may want to do that manually after checking everything, for example."
|
||||||
|
echo -e " $S_WARN-b$S_NORM \t\t\tDon't create automatic \`release-<version>\` branch"
|
||||||
|
echo -e " $S_WARN-h$S_NORM \t\t\tShow this help message. "
|
||||||
|
echo -e "\n ${S_NORM}${BOLD}Author:$S_LIGHT https://github.com/jv-t/bump-version $RESET\n"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# If there are no commits in repo, quit, because you can't tag with zero commits.
|
||||||
|
check-commits-exist() {
|
||||||
|
git rev-parse HEAD &> /dev/null
|
||||||
|
if [ ! "$?" -eq 0 ]; then
|
||||||
|
echo -e "\n${I_STOP} ${S_ERROR}Your current branch doesn't have any commits yet. Can't tag without at least one commit." >&2
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
get-commit-msg() {
|
||||||
|
echo Bumped $([ -n "${V_PREV}" ] && echo "${V_PREV} –>" || echo "to ") "$V_USR_INPUT"
|
||||||
|
}
|
||||||
|
|
||||||
|
exit_abnormal() {
|
||||||
|
echo -e " ${S_LIGHT}––––––"
|
||||||
|
usage # Show help
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Process script options
|
||||||
|
process-arguments() {
|
||||||
|
local OPTIONS OPTIND OPTARG
|
||||||
|
|
||||||
|
# Get positional parameters
|
||||||
|
JSON_FILES=( )
|
||||||
|
while getopts ":v:p:m:f:hbn" OPTIONS; do # Note: Adding the first : before the flags takes control of flags and prevents default error msgs.
|
||||||
|
case "$OPTIONS" in
|
||||||
|
h )
|
||||||
|
# Show help
|
||||||
|
exit_abnormal
|
||||||
|
;;
|
||||||
|
v )
|
||||||
|
# User has supplied a version number
|
||||||
|
V_USR_SUPPLIED=$OPTARG
|
||||||
|
;;
|
||||||
|
m )
|
||||||
|
REL_NOTE=$OPTARG
|
||||||
|
# Custom release note
|
||||||
|
echo -e "\n${S_LIGHT}Option set: ${S_NOTICE}Release note:" ${S_NORM}"'"$REL_NOTE"'"
|
||||||
|
;;
|
||||||
|
f )
|
||||||
|
FLAG_JSON=true
|
||||||
|
echo -e "\n${S_LIGHT}Option set: ${S_NOTICE}JSON file via [-f]: <${S_NORM}${OPTARG}${S_LIGHT}>"
|
||||||
|
# Store JSON filenames(s)
|
||||||
|
JSON_FILES+=($OPTARG)
|
||||||
|
;;
|
||||||
|
p )
|
||||||
|
FLAG_PUSH=true
|
||||||
|
PUSH_DEST=${OPTARG} # Replace default with user input
|
||||||
|
echo -e "\n${S_LIGHT}Option set: ${S_NOTICE}Pushing to <${S_NORM}${PUSH_DEST}${S_LIGHT}>, as the last action in this script."
|
||||||
|
;;
|
||||||
|
n )
|
||||||
|
FLAG_NOCOMMIT=true
|
||||||
|
echo -e "\n${S_LIGHT}Option set: ${S_NOTICE}Disable commit after tagging."
|
||||||
|
;;
|
||||||
|
b )
|
||||||
|
FLAG_NOBRANCH=true
|
||||||
|
echo -e "\n${S_LIGHT}Option set: ${S_NOTICE}Disable committing to new branch."
|
||||||
|
;;
|
||||||
|
\? )
|
||||||
|
echo -e "\n${I_ERROR}${S_ERROR} Invalid option: ${S_WARN}-$OPTARG" >&2
|
||||||
|
echo
|
||||||
|
exit_abnormal
|
||||||
|
;;
|
||||||
|
: )
|
||||||
|
echo -e "\n${I_ERROR}${S_ERROR} Option ${S_WARN}-$OPTARG ${S_ERROR}requires an argument." >&2
|
||||||
|
echo
|
||||||
|
exit_abnormal
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Suggests version from VERSION file, or grabs from user supplied -v <version>.
|
||||||
|
# If none is set, suggest default from options.
|
||||||
|
process-version() {
|
||||||
|
if [ -f VERSION ] && [ -s VERSION ]; then
|
||||||
|
V_PREV=`cat VERSION`
|
||||||
|
|
||||||
|
echo -e "\n${S_NOTICE}Current version from <${S_NORM}VERSION${S_NOTICE}> file: ${S_NORM}$V_PREV"
|
||||||
|
|
||||||
|
# Suggest incremented value from VERSION file
|
||||||
|
V_PREV_LIST=(`echo $V_PREV | tr '.' ' '`)
|
||||||
|
V_MAJOR=${V_PREV_LIST[0]}; V_MINOR=${V_PREV_LIST[1]}; V_PATCH=${V_PREV_LIST[2]};
|
||||||
|
|
||||||
|
# Test if V_PATCH is a number, then increment it. Otherwise, do nothing
|
||||||
|
if [ "$V_PATCH" -eq "$V_PATCH" ] 2>/dev/null; then # discard stderr (2) output to black hole (suppress it)
|
||||||
|
V_PATCH=$((V_PATCH + 1)) # Increment
|
||||||
|
fi
|
||||||
|
|
||||||
|
V_SUGGEST="$V_MAJOR.$V_MINOR.$V_PATCH"
|
||||||
|
else
|
||||||
|
echo -ne "\n${S_WARN}The [${S_NORM}VERSION${S_WARN}] "
|
||||||
|
if [ ! -f VERSION ]; then
|
||||||
|
echo "file was not found.";
|
||||||
|
elif [ ! -s VERSION ]; then
|
||||||
|
echo "file is empty.";
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If a version number is supplied by the user with [-v <version number>], then use it
|
||||||
|
if [ -n "$V_USR_SUPPLIED" ]; then
|
||||||
|
echo -e "\n${S_NOTICE}You selected version using [-v]:" "${S_WARN}${V_USR_SUPPLIED}"
|
||||||
|
V_USR_INPUT="${V_USR_SUPPLIED}"
|
||||||
|
else
|
||||||
|
echo -ne "\n${S_QUESTION}Enter a new version number [${S_NORM}$V_SUGGEST${S_QUESTION}]: "
|
||||||
|
echo -ne "$S_WARN"
|
||||||
|
read V_USR_INPUT
|
||||||
|
|
||||||
|
if [ "$V_USR_INPUT" = "" ]; then
|
||||||
|
V_USR_INPUT="${V_SUGGEST}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# echo -e "${S_NOTICE}Setting version to [${S_NORM}${V_USR_INPUT}${S_NOTICE}] ...."
|
||||||
|
}
|
||||||
|
|
||||||
|
# Only tag if tag doesn't already exist
|
||||||
|
check-tag-exists() {
|
||||||
|
TAG_CHECK_EXISTS=`git tag -l v"$V_USR_INPUT"`
|
||||||
|
if [ -n "$TAG_CHECK_EXISTS" ]; then
|
||||||
|
echo -e "\n${I_STOP} ${S_ERROR}Error: A release with that tag version number already exists!\n"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# $1 : version
|
||||||
|
# $2 : release note
|
||||||
|
tag() {
|
||||||
|
if [ -z "$2" ]; then
|
||||||
|
# Default release note
|
||||||
|
git tag -a "v$1" -m "Tag version $1."
|
||||||
|
else
|
||||||
|
# Custom release note
|
||||||
|
git tag -a "v$1" -m "$2"
|
||||||
|
fi
|
||||||
|
echo -e "\n${I_OK} ${S_NOTICE}Added GIT tag"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Change `version:` value in JSON files, like packager.json, composer.json, etc
|
||||||
|
bump-json-files() {
|
||||||
|
if [ "$FLAG_JSON" != true ]; then return; fi
|
||||||
|
|
||||||
|
JSON_PROCESSED=( ) # holds filenames after they've been changed
|
||||||
|
|
||||||
|
for FILE in "${JSON_FILES[@]}"; do
|
||||||
|
if [ -f $FILE ]; then
|
||||||
|
# Get the existing version number
|
||||||
|
V_OLD=$( sed -n 's/.*"version": "\(.*\)",/\1/p' $FILE )
|
||||||
|
|
||||||
|
if [ "$V_OLD" = "$V_USR_INPUT" ]; then
|
||||||
|
echo -e "\n${S_WARN}File <${S_NORM}$FILE${S_WARN}> already contains version: ${S_NORM}$V_OLD"
|
||||||
|
else
|
||||||
|
# Write to output file
|
||||||
|
FILE_MSG=`sed -i .temp "s/\"version\": \"$V_OLD\"/\"version\": \"$V_USR_INPUT\"/g" $FILE 2>&1`
|
||||||
|
if [ "$?" -eq 0 ]; then
|
||||||
|
echo -e "\n${I_OK} ${S_NOTICE}Updated file: <${S_NOTICE}$FILE${S_LIGHT}> from ${S_NORM}$V_OLD -> $V_USR_INPUT"
|
||||||
|
rm -f ${FILE}.temp
|
||||||
|
# Add file change to commit message:
|
||||||
|
GIT_MSG+="${GIT_MSG}Updated $FILE, "
|
||||||
|
else
|
||||||
|
echo -e "\n${I_STOP} ${S_ERROR}Error\n$PUSH_MSG\n"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
JSON_PROCESSED+=($FILE)
|
||||||
|
else
|
||||||
|
echo -e "\n${S_WARN}File <${S_NORM}$FILE${S_WARN}> not found."
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
# Stage files that were changed:
|
||||||
|
[ -n "${JSON_PROCESSED}" ] && git add "${JSON_PROCESSED[@]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Handle VERSION file
|
||||||
|
do-versionfile() {
|
||||||
|
[ -f VERSION ] && ACTION_MSG="Updated" || ACTION_MSG="Created"
|
||||||
|
|
||||||
|
GIT_MSG+="${ACTION_MSG} VERSION, "
|
||||||
|
echo $V_USR_INPUT > VERSION # Create file
|
||||||
|
echo -e "\n${I_OK} ${S_NOTICE}${ACTION_MSG} [${S_NORM}VERSION${S_NOTICE}] file"
|
||||||
|
|
||||||
|
# Stage file for commit
|
||||||
|
git add VERSION
|
||||||
|
}
|
||||||
|
|
||||||
|
# Dump git log history to CHANGELOG.md
|
||||||
|
do-changelog() {
|
||||||
|
|
||||||
|
# Log latest commits to CHANGELOG.md:
|
||||||
|
# Get latest commits
|
||||||
|
LOG_MSG=`git log --pretty=format:"- %s" $([ -n "$V_PREV" ] && echo "v${V_PREV}...HEAD") 2>&1`
|
||||||
|
if [ ! "$?" -eq 0 ]; then
|
||||||
|
echo -e "\n${I_STOP} ${S_ERROR}Error getting commit history for logging to CHANGELOG.\n$LOG_MSG\n"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -f CHANGELOG.md ] && ACTION_MSG="Updated" || ACTION_MSG="Created"
|
||||||
|
# Add info to commit message for later:
|
||||||
|
GIT_MSG+="${ACTION_MSG} CHANGELOG.md, "
|
||||||
|
|
||||||
|
# Add heading
|
||||||
|
echo "## $V_USR_INPUT ($NOW)" > tmpfile
|
||||||
|
|
||||||
|
# Log the bumping commit:
|
||||||
|
# - The final commit is done after do-changelog(), so we need to create the log entry for it manually:
|
||||||
|
echo "- ${GIT_MSG}$(get-commit-msg)" >> tmpfile
|
||||||
|
# Add previous commits
|
||||||
|
[ -n "$LOG_MSG" ] && echo "$LOG_MSG" >> tmpfile
|
||||||
|
|
||||||
|
echo -en "\n" >> tmpfile
|
||||||
|
|
||||||
|
if [ -f CHANGELOG.md ]; then
|
||||||
|
# Append existing log
|
||||||
|
cat CHANGELOG.md >> tmpfile
|
||||||
|
else
|
||||||
|
echo -e "\n${S_WARN}A [${S_NORM}CHANGELOG.md${S_WARN}] file was not found."
|
||||||
|
fi
|
||||||
|
|
||||||
|
mv tmpfile CHANGELOG.md
|
||||||
|
|
||||||
|
# User prompts
|
||||||
|
echo -e "\n${I_OK} ${S_NOTICE}${ACTION_MSG} [${S_NORM}CHANGELOG.md${S_NOTICE}] file"
|
||||||
|
# Pause & allow user to open and edit the file:
|
||||||
|
echo -en "\n${S_QUESTION}Make adjustments to [${S_NORM}CHANGELOG.md${S_QUESTION}] if required now. Press <enter> to continue."
|
||||||
|
read
|
||||||
|
|
||||||
|
# Stage log file, to commit later
|
||||||
|
git add CHANGELOG.md
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
check-branch-exist() {
|
||||||
|
[ "$FLAG_NOBRANCH" = true ] && return
|
||||||
|
|
||||||
|
BRANCH_MSG=`git rev-parse --verify "${REL_PREFIX}${V_USR_INPUT}" 2>&1`
|
||||||
|
if [ "$?" -eq 0 ]; then
|
||||||
|
echo -e "\n${I_STOP} ${S_ERROR}Error: Branch <${S_NORM}${REL_PREFIX}${V_USR_INPUT}${S_ERROR}> already exists!\n"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
do-branch() {
|
||||||
|
[ "$FLAG_NOBRANCH" = true ] && return
|
||||||
|
|
||||||
|
echo -e "\n${S_NOTICE}Creating new release branch..."
|
||||||
|
|
||||||
|
BRANCH_MSG=`git branch "${REL_PREFIX}${V_USR_INPUT}" 2>&1`
|
||||||
|
if [ ! "$?" -eq 0 ]; then
|
||||||
|
echo -e "\n${I_STOP} ${S_ERROR}Error\n$BRANCH_MSG\n"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
BRANCH_MSG=`git checkout "${REL_PREFIX}${V_USR_INPUT}" 2>&1`
|
||||||
|
echo -e "\n${I_OK} ${S_NOTICE}${BRANCH_MSG}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# REL_PREFIX
|
||||||
|
}
|
||||||
|
|
||||||
|
# Stage & commit all files modified by this script
|
||||||
|
do-commit() {
|
||||||
|
[ "$FLAG_NOCOMMIT" = true ] && return
|
||||||
|
|
||||||
|
GIT_MSG+="$(get-commit-msg)"
|
||||||
|
echo -e "\n${S_NOTICE}Committing..."
|
||||||
|
COMMIT_MSG=`git commit -m "${GIT_MSG}" 2>&1`
|
||||||
|
if [ ! "$?" -eq 0 ]; then
|
||||||
|
echo -e "\n${I_STOP} ${S_ERROR}Error\n$COMMIT_MSG\n"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo -e "\n${I_OK} ${S_NOTICE}$COMMIT_MSG"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Pushes files + tags to remote repo. Changes are staged by earlier functions
|
||||||
|
do-push() {
|
||||||
|
[ "$FLAG_NOCOMMIT" = true ] && return
|
||||||
|
|
||||||
|
if [ "$FLAG_PUSH" = true ]; then
|
||||||
|
CONFIRM="Y"
|
||||||
|
else
|
||||||
|
echo -ne "\n${S_QUESTION}Push tags to <${S_NORM}${PUSH_DEST}${S_QUESTION}>? [${S_NORM}N/y${S_QUESTION}]: "
|
||||||
|
read CONFIRM
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$CONFIRM" in
|
||||||
|
[yY][eE][sS]|[yY] )
|
||||||
|
echo -e "\n${S_NOTICE}Pushing files + tags to <${S_NORM}${PUSH_DEST}${S_NOTICE}>..."
|
||||||
|
PUSH_MSG=`git push "${PUSH_DEST}" v"$V_USR_INPUT" 2>&1` # Push new tag
|
||||||
|
if [ ! "$?" -eq 0 ]; then
|
||||||
|
echo -e "\n${I_STOP} ${S_WARN}Warning\n$PUSH_MSG"
|
||||||
|
# exit 1
|
||||||
|
else
|
||||||
|
echo -e "\n${I_OK} ${S_NOTICE}$PUSH_MSG"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
#### Initiate Script ###########################
|
||||||
|
|
||||||
|
check-commits-exist
|
||||||
|
|
||||||
|
# Process and prepare
|
||||||
|
process-arguments "$@"
|
||||||
|
process-version
|
||||||
|
|
||||||
|
check-branch-exist
|
||||||
|
check-tag-exists
|
||||||
|
|
||||||
|
echo -e "\n${S_LIGHT}––––––"
|
||||||
|
|
||||||
|
# Update files
|
||||||
|
bump-json-files
|
||||||
|
do-versionfile
|
||||||
|
# do-changelog
|
||||||
|
# do-branch
|
||||||
|
do-commit
|
||||||
|
tag "${V_USR_INPUT}" "${REL_NOTE}"
|
||||||
|
do-push
|
||||||
|
|
||||||
|
echo -e "\n${S_LIGHT}––––––"
|
||||||
|
echo -e "\n${I_OK} ${S_NOTICE}"Bumped $([ -n "${V_PREV}" ] && echo "${V_PREV} –>" || echo "to ") "$V_USR_INPUT"
|
||||||
|
echo -e "\n${GREEN}Done ${I_END}\n"
|
9
scripts/install-fedora.sh
Executable file
9
scripts/install-fedora.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
sudo dnf install -y \
|
||||||
|
qt5-qtbase-devel \
|
||||||
|
qt5-qtwebengine-devel \
|
||||||
|
qt5-qtwebsockets-devel \
|
||||||
|
openconnect
|
||||||
|
|
||||||
|
./scripts/install.sh
|
9
scripts/install-opensuse.sh
Executable file
9
scripts/install-opensuse.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
sudo zypper install -y \
|
||||||
|
libqt5-qtbase-devel \
|
||||||
|
libqt5-qtwebsockets-devel \
|
||||||
|
libqt5-qtwebengine-devel \
|
||||||
|
openconnect
|
||||||
|
|
||||||
|
./scripts/install.sh
|
11
scripts/install-ubuntu.sh
Executable file
11
scripts/install-ubuntu.sh
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install -y \
|
||||||
|
build-essential \
|
||||||
|
qtbase5-dev \
|
||||||
|
libqt5websockets5-dev \
|
||||||
|
qtwebengine5-dev \
|
||||||
|
openconnect
|
||||||
|
|
||||||
|
./scripts/install.sh
|
10
scripts/install.sh
Executable file
10
scripts/install.sh
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
./cmakew -B build -DCMAKE_BUILD_TYPE=Release
|
||||||
|
MAKEFLAGS=-j$(nproc) ./cmakew --build build
|
||||||
|
sudo ./cmakew --install build
|
||||||
|
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
sudo systemctl restart gpservice.service
|
||||||
|
|
||||||
|
echo -e "\nSuccess. You can launch the GlobalProtect VPN client from the application dashboard.\n"
|
@ -1 +0,0 @@
|
|||||||
Subproject commit 0f6695e2a9d8fdaa336e7ad941855c46c61f218a
|
|
1
version.h.in
Normal file
1
version.h.in
Normal file
@ -0,0 +1 @@
|
|||||||
|
#define VERSION "@GlobalProtect-openconnect_VERSION@"
|
Loading…
Reference in New Issue
Block a user