Commit 6cd25ded authored by Henri Chain's avatar Henri Chain 🛰
Browse files

Add a new standalone executable to replace X-KDE-Autostart-Condition

Summary:
For systemd autostart generator will add a ExecCondition=kde-systemd-start-condition rcfile:section:entry:default
As described in T12627. Needs D28421

Test Plan:
Run kde-systemd-start-condition; should return 0 with a missing or incomplete argument, 255 with a false or non-existent and non-default con
fig value.

Reviewers: davidedmundson, broulik, dfaure, ngraham, meven

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D28424
parent c8c7a825
......@@ -15,6 +15,7 @@ qt5_add_dbus_interface(
add_executable(startplasma-x11 startplasma.cpp startplasma-x11.cpp kcheckrunning/kcheckrunning.cpp ${startplasma_SRCS})
add_executable(startplasma-wayland startplasma.cpp startplasma-wayland.cpp ${startplasma_SRCS})
add_executable(startplasma-waylandsession startplasma.cpp startplasma-waylandsession.cpp ${startplasma_SRCS})
add_executable(kde-systemd-start-condition kde-systemd-start-condition.cpp)
target_include_directories(startplasma-x11 PRIVATE ${X11_X11_INCLUDE_PATH})
target_link_libraries(startplasma-x11 PRIVATE Qt5::Core Qt5::DBus KF5::ConfigCore
......@@ -22,6 +23,7 @@ target_link_libraries(startplasma-x11 PRIVATE Qt5::Core Qt5::DBus KF5::ConfigCor
)
target_link_libraries(startplasma-wayland PRIVATE Qt5::Core Qt5::DBus KF5::ConfigCore)
target_link_libraries(startplasma-waylandsession PRIVATE Qt5::Core Qt5::DBus KF5::ConfigCore)
target_link_libraries(kde-systemd-start-condition PUBLIC KF5::ConfigCore KF5::Service)
add_subdirectory(plasma-session)
add_subdirectory(plasma-shutdown)
......@@ -37,3 +39,6 @@ install(TARGETS startplasma-x11 ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
install(TARGETS startplasma-wayland ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
install(TARGETS startplasma-waylandsession DESTINATION ${KDE_INSTALL_LIBEXECDIR})
install(PROGRAMS plasma-sourceenv.sh DESTINATION ${KDE_INSTALL_LIBEXECDIR})
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
install(TARGETS kde-systemd-start-condition DESTINATION ${KDE_INSTALL_BINDIR})
endif ()
/*
Copyright (c) 2020 Henri Chain <henri.chain@enioka.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <kautostart.h>
#include <QCommandLineOption>
#include <QCommandLineParser>
#include <QCoreApplication>
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
QCommandLineParser parser;
parser.setApplicationDescription(QStringLiteral("Checks start condition for a KDE systemd service"));
parser.addHelpOption();
parser.addPositionalArgument(QStringLiteral("condition"),
QStringLiteral("start condition, in the format 'rcfile:group:entry:default'"));
parser.process(app);
if (!parser.positionalArguments().count()) {
parser.showHelp(0);
}
if (KAutostart::isStartConditionMet(parser.positionalArguments().at(0))) {
return 0;
} else {
return 255;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment