aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--conf/system/afm-system-setup.service9
-rw-r--r--conf/system/afm-user-setup@.service8
-rw-r--r--conf/user/afm-user-session.service10
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/afm-user-session.c21
5 files changed, 37 insertions, 13 deletions
diff --git a/conf/system/afm-system-setup.service b/conf/system/afm-system-setup.service
new file mode 100644
index 0000000..260975c
--- /dev/null
+++ b/conf/system/afm-system-setup.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=Initiate afm-system-setup
+Before=weston.service
+[Service]
+Type=one-shot
+ExecStart=-/bin/sh -c "/bin/mkdir -m 755 -Z '*' /run/platform"
+ExecStart=-/bin/sh -c "/bin/mkdir -m 755 -Z '*' /run/platform/display"
+ExecStart=-/bin/sh -c "/bin/mkdir -m 755 -Z '*' /run/platform/apis"
+ExecStart=-/bin/sh -c "/bin/mkdir -m 755 -Z '*' /run/platform/apis/ws"
diff --git a/conf/system/afm-user-setup@.service b/conf/system/afm-user-setup@.service
new file mode 100644
index 0000000..2cc4214
--- /dev/null
+++ b/conf/system/afm-user-setup@.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=Initiate afm-user-setup %i
+After=user@%i.service
+[Service]
+Type=one-shot
+ExecStart=-/bin/sh -c "/bin/mkdir -Z '*' /run/user/%i && /bin/chown %i:%i /run/user/%i"
+ExecStart=-/bin/sh -c "/bin/mkdir -Z '*' /run/user/%i/apis && /bin/chown %i:%i /run/user/%i/apis"
+ExecStart=-/bin/sh -c "/bin/mkdir -Z '*' /run/user/%i/apis/ws && /bin/chown %i:%i /run/user/%i/apis/ws"
diff --git a/conf/user/afm-user-session.service b/conf/user/afm-user-session.service
new file mode 100644
index 0000000..6896ecd
--- /dev/null
+++ b/conf/user/afm-user-session.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Application Framework Master, User session setup
+
+[Service]
+Type=notify
+ExecStart=/usr/bin/afm-user-session
+
+[Install]
+WantedBy=default.target
+
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6a1b497..6aff23e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -177,7 +177,7 @@ if(libsystemd_FOUND AND AFB_FOUND)
install(TARGETS afm-binding LIBRARY DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/afm)
add_executable(afm-user-session afm-user-session.c)
- install(TARGETS afm-user-session DESTINATION ${CMAKE_INSTALL_BINDIR})
+ install(TARGETS afm-user-session DESTINATION ${CMAKE_INSTALL_BINDIR} PERMISSIONS SETUID OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)
else()
MESSAGE(STATUS "Not creating daemons")
endif()
diff --git a/src/afm-user-session.c b/src/afm-user-session.c
index 51acafe..445db91 100644
--- a/src/afm-user-session.c
+++ b/src/afm-user-session.c
@@ -16,23 +16,20 @@
limitations under the License.
*/
-#include <signal.h>
+#include <stdio.h>
+#include <unistd.h>
#include <systemd/sd-daemon.h>
+extern char **environ;
+
int main()
{
- sigset_t ass, bss;
-
- sigemptyset(&ass);
- sigaddset(&ass, SIGTERM);
-
- sigfillset(&bss);
- sigdelset(&bss, SIGTERM);
+ char buffer[100];
+ char *args[] = { "/bin/systemctl", "--wait", "start", buffer, 0 };
+ sprintf(buffer, "afm-user-session@%d.target", (int)getuid());
sd_notify(0, "READY=1");
- sigprocmask(SIG_SETMASK, &bss, 0);
- sigwaitinfo(&ass, 0);
-
- return 0;
+ execve(args[0], args, environ);
+ return 1;
}