From 3ed2965b8bee048c1478978e13df5253c82ae16e Mon Sep 17 00:00:00 2001 From: INSUN PYO Date: Thu, 3 Sep 2020 17:39:12 +0900 Subject: [PATCH] Change package name: systemd-user-helper ==> dbus-activation-stop-test Change-Id: I3762fb80c94121f553d1af637ab5f1a7e6a140b0 --- CMakeLists.txt | 2 +- packaging/session-utils.spec | 24 ++++++++++++++++--- .../CMakeLists.txt | 4 ++-- .../dbus-activation-stop-test.c} | 10 ++++---- systemd-user-helper.service | 9 ------- units/dbus-activation-stop-test.conf | 12 ++++++++++ units/dbus-activation-stop-test.service | 9 +++++++ 7 files changed, 50 insertions(+), 20 deletions(-) rename src/{systemd-user-helper => dbus-activation-stop-test}/CMakeLists.txt (83%) rename src/{systemd-user-helper/systemd-user-helper.c => dbus-activation-stop-test/dbus-activation-stop-test.c} (88%) delete mode 100644 systemd-user-helper.service create mode 100644 units/dbus-activation-stop-test.conf create mode 100644 units/dbus-activation-stop-test.service diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f27d51..36312fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,4 +3,4 @@ PROJECT(session-utils C) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) -ADD_SUBDIRECTORY(src/systemd-user-helper) +ADD_SUBDIRECTORY(src/dbus-activation-stop-test) diff --git a/packaging/session-utils.spec b/packaging/session-utils.spec index 2f002bc..5fdd396 100644 --- a/packaging/session-utils.spec +++ b/packaging/session-utils.spec @@ -23,6 +23,15 @@ BuildArch: noarch %description -n g_debug_fatal_warnings This package provices the configuration file that enable glib debugging. + +############################################################################### +%package -n dbus-activation-stop-test +Summary: dbus activation stop test. + +%description -n dbus-activation-stop-test +This package provices the test code of dbus activation stopping. + + ############################################################################### %prep %setup -q @@ -44,15 +53,24 @@ install -m 644 units/g_debug_fatal_warnings.conf %{buildroot}/etc/systemd/user.c install -m 644 units/g_debug_fatal_warnings.conf %{buildroot}/etc/systemd/system.conf.d/ mkdir -p %{buildroot}%{_unitdir} -cp systemd-user-helper.service %{buildroot}%{_unitdir}/ +mkdir -p %{buildroot}%{_sysconfdir}/dbus-1/system.d +install -m 644 units/dbus-activation-stop-test.service %{buildroot}%{_unitdir}/ +install -m 644 units/dbus-activation-stop-test.conf %{buildroot}%{_sysconfdir}/dbus-1/system.d/ ############################################################################### %files %license LICENSE.Apache-2.0 %manifest session-utils.manifest -%{_bindir}/systemd-user-helper -%{_unitdir}/systemd-user-helper.service + + +############################################################################### +%files -n dbus-activation-stop-test +%license LICENSE.Apache-2.0 +%manifest session-utils.manifest +%config %{_sysconfdir}/dbus-1/system.d/dbus-activation-stop-test.conf +%{_bindir}/dbus-activation-stop-test +%{_unitdir}/dbus-activation-stop-test.service ############################################################################### diff --git a/src/systemd-user-helper/CMakeLists.txt b/src/dbus-activation-stop-test/CMakeLists.txt similarity index 83% rename from src/systemd-user-helper/CMakeLists.txt rename to src/dbus-activation-stop-test/CMakeLists.txt index 3be879b..857dad3 100644 --- a/src/systemd-user-helper/CMakeLists.txt +++ b/src/dbus-activation-stop-test/CMakeLists.txt @@ -1,5 +1,5 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(systemd-user-helper C) +PROJECT(dbus-activation-stop-test C) INCLUDE(FindPkgConfig) pkg_check_modules(pkgs REQUIRED @@ -14,7 +14,7 @@ ENDFOREACH(flag) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE") -ADD_EXECUTABLE(${PROJECT_NAME} systemd-user-helper.c) +ADD_EXECUTABLE(${PROJECT_NAME} dbus-activation-stop-test.c) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} -pie) INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin diff --git a/src/systemd-user-helper/systemd-user-helper.c b/src/dbus-activation-stop-test/dbus-activation-stop-test.c similarity index 88% rename from src/systemd-user-helper/systemd-user-helper.c rename to src/dbus-activation-stop-test/dbus-activation-stop-test.c index 9bca4b4..fe0036f 100644 --- a/src/systemd-user-helper/systemd-user-helper.c +++ b/src/dbus-activation-stop-test/dbus-activation-stop-test.c @@ -25,7 +25,7 @@ #include -int id; +int owner_id; static GMainLoop *mainloop; static void sig_term(int signo) @@ -38,7 +38,7 @@ static void sig_abort(int signo) fprintf (stderr, "sig abort\n"); sd_notify(0, "STOPPING=1"); - g_bus_unown_name (id); + g_bus_unown_name (owner_id); } static void sig_quit(int signo) @@ -69,10 +69,10 @@ int main(int argc, char *argv[]) return -1; } - id = g_bus_own_name_on_connection(conn, "org.tizen.myname", G_BUS_NAME_OWNER_FLAGS_NONE, - name_acquire, name_lost, NULL, NULL); + owner_id = g_bus_own_name_on_connection(conn, "org.tizen.dbus-activation-stop-test", G_BUS_NAME_OWNER_FLAGS_NONE, + name_acquire, name_lost, NULL, NULL); - if (id == 0) { + if (owner_id == 0) { fprintf (stderr, "g_bus_own_name_on_connection fails\n"); return -1; } diff --git a/systemd-user-helper.service b/systemd-user-helper.service deleted file mode 100644 index a587f45..0000000 --- a/systemd-user-helper.service +++ /dev/null @@ -1,9 +0,0 @@ -[Unit] -Description=systemd user helper - -[Service] -SmackProcessLabel=System -Type=dbus -BusName=org.tizen.myname -ExecStart=/usr/bin/systemd-user-helper -NotifyAccess=main diff --git a/units/dbus-activation-stop-test.conf b/units/dbus-activation-stop-test.conf new file mode 100644 index 0000000..c683a05 --- /dev/null +++ b/units/dbus-activation-stop-test.conf @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/units/dbus-activation-stop-test.service b/units/dbus-activation-stop-test.service new file mode 100644 index 0000000..7a74f1e --- /dev/null +++ b/units/dbus-activation-stop-test.service @@ -0,0 +1,9 @@ +[Unit] +Description=dbus activation stop test + +[Service] +Type=dbus +BusName=org.tizen.dbus-activation-stop-test +ExecStart=/usr/bin/dbus-activation-stop-test +NotifyAccess=main +SmackProcessLabel=System \ No newline at end of file -- 2.34.1