update packaging (#100)

This commit is contained in:
Kevin Yue
2021-10-24 12:11:54 +08:00
committed by GitHub
parent 36d9753008
commit 9e7fb17bd3
46 changed files with 823 additions and 1192 deletions

View File

@@ -4,6 +4,9 @@ project(GPService)
set(gpservice_GENERATED_SOURCES)
configure_file(dbus/com.yuezk.qt.GPService.service.in dbus/com.yuezk.qt.GPService.service)
configure_file(systemd/gpservice.service.in systemd/gpservice.service)
# generate the dbus xml definition
qt5_generate_dbus_interface(
gpservice.h
@@ -30,10 +33,9 @@ add_3rdparty(
GIT_TAG v3.3.0
CMAKE_ARGS
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE}
-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
)
@@ -60,7 +62,13 @@ target_link_libraries(gpservice
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")
install(TARGETS gpservice DESTINATION bin)
install(FILES "dbus/com.yuezk.qt.GPService.conf" DESTINATION share/dbus-1/system.d )
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/dbus/com.yuezk.qt.GPService.service" DESTINATION share/dbus-1/system-services)
if("$ENV{DEBIAN_PACKAGE}")
# Install the systemd unit files to /lib/systemd/system for debian package
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/systemd/gpservice.service" DESTINATION /lib/systemd/system)
else()
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/systemd/gpservice.service" DESTINATION lib/systemd/system)
endif()

View File

@@ -1,5 +1,5 @@
[D-BUS Service]
Name=com.yuezk.qt.GPService
Exec=/usr/bin/gpservice
Exec=@CMAKE_INSTALL_PREFIX@/bin/gpservice
User=root
SystemdService=gpservice.service

View File

@@ -115,12 +115,13 @@ void GPService::connect(QString server, QString username, QString passwd, QStrin
<< "--protocol=gp"
<< splitCommand(extraArgs)
<< "-u" << username
<< "-C" << passwd
<< "--cookie-on-stdin"
<< server;
log("Start process with arugments: " + args.join(" "));
openconnect->start(bin, args);
openconnect->write((passwd + "\n").toUtf8());
}
bool GPService::isValidVersion(QString &bin) {

View File

@@ -5,7 +5,7 @@ Description=GlobalProtect openconnect DBus service
Environment="LANG=en_US.utf8"
Type=dbus
BusName=com.yuezk.qt.GPService
ExecStart=/usr/bin/gpservice
ExecStart=@CMAKE_INSTALL_PREFIX@/bin/gpservice
[Install]
WantedBy=multi-user.target