tizen: Add additional unit for "unified" user session 33/204133/1 accepted/tizen/unified/20190508.111204 submit/tizen/20190508.045622
authorMateusz Moscicki <m.moscicki2@partner.samsung.com>
Fri, 19 Apr 2019 11:28:34 +0000 (13:28 +0200)
committerMateusz Moscicki <m.moscicki2@partner.samsung.com>
Fri, 19 Apr 2019 13:35:20 +0000 (15:35 +0200)
The unified user session is about moving user session units, managed by
systemd --user, to main systemd, where it's managed as part of newly
created user@.target.

user@.target will contain same units as previously available in user/,
with same UID and environment setup.  systemd instance is used for unit
to be able to specify UID (inherited from user@.target).

The rationale behind this work is following:

* VD requirement to remove user session support
* boot time optimization requirements, due to:

   + 'systemd --user' taking 1s its own startup that could be used for
     unit startup
   + ability to better rearrange units if these managed by one systemd
     instance

Unit installed by this commit will not be used till user login mechanism
will be changed in systemd package (via changing pam_systemd to start
user@.target, rather than user@.service).

Change-Id: I26e2fb649b1cb509c8d067899e5c55be53b36d74

configure.ac
packaging/efl-config-ondemand@.service.in [new file with mode: 0644]
packaging/efl-config-post@.service.in [new file with mode: 0644]
packaging/efl-config.spec
packaging/efl-config@.service.in [new file with mode: 0644]
packaging/efl-config@.socket [new file with mode: 0644]

index eafb272..31e7f87 100644 (file)
@@ -29,5 +29,8 @@ AC_CONFIG_FILES([Makefile
             packaging/efl-config.service
             packaging/efl-config-post.service
             packaging/efl-config-ondemand.service
+            packaging/efl-config@.service
+            packaging/efl-config-post@.service
+            packaging/efl-config-ondemand@.service
             ])
 AC_OUTPUT
diff --git a/packaging/efl-config-ondemand@.service.in b/packaging/efl-config-ondemand@.service.in
new file mode 100644 (file)
index 0000000..f081bbf
--- /dev/null
@@ -0,0 +1,12 @@
+[Unit]
+PartOf=userlogin@%i.target
+Description=Change the efl configures.
+
+[Service]
+User=%i
+Environment=DBUS_SESSION_BUS_ADDRESS=kernel:path=/sys/fs/kdbus/%i-user/bus;unix:path=/run/user/%i/bus
+Environment=XDG_RUNTIME_DIR=/run/user/%i
+SmackProcessLabel=User
+Type=simple
+ExecStart=@TZ_SYS_BIN@/efl_config --with-message
+EnvironmentFile=-/run/tizen-system-env
diff --git a/packaging/efl-config-post@.service.in b/packaging/efl-config-post@.service.in
new file mode 100644 (file)
index 0000000..b08699b
--- /dev/null
@@ -0,0 +1,12 @@
+[Unit]
+PartOf=userlogin@%i.target
+Description=Change the efl configures.
+
+[Service]
+User=%i
+Environment=DBUS_SESSION_BUS_ADDRESS=kernel:path=/sys/fs/kdbus/%i-user/bus;unix:path=/run/user/%i/bus
+Environment=XDG_RUNTIME_DIR=/run/user/%i
+SmackProcessLabel=User
+Type=simple
+ExecStart=@TZ_SYS_BIN@/efl_config
+EnvironmentFile=-/run/tizen-system-env
index 0a6790e..05725c8 100644 (file)
@@ -39,16 +39,28 @@ rm -rf %{buildroot}
 mkdir -p %{buildroot}%{_unitdir_user}/basic.target.wants
 mkdir -p %{buildroot}%{_unitdir_user}/default.target.wants
 mkdir -p %{buildroot}%{_unitdir_user}/sockets.target.wants
+mkdir -p %{buildroot}%{_unitdir}/user-basic@.target.wants
+mkdir -p %{buildroot}%{_unitdir}/user-default@.target.wants
+mkdir -p %{buildroot}%{_unitdir}/user-sockets@.target.wants
 
 install -m 0644 %{_builddir}/%{name}-%{version}/packaging/%{alias}.service %{buildroot}%{_unitdir_user}/%{alias}.service
 install -m 0644 %{_builddir}/%{name}-%{version}/packaging/%{alias}-post.service %{buildroot}%{_unitdir_user}/%{alias}-post.service
 install -m 0644 %{_builddir}/%{name}-%{version}/packaging/%{alias}-ondemand.service %{buildroot}%{_unitdir_user}/%{alias}-ondemand.service
 install -m 0644 %{_builddir}/%{name}-%{version}/packaging/%{alias}.socket %{buildroot}%{_unitdir_user}/%{alias}.socket
 
+install -m 0644 %{_builddir}/%{name}-%{version}/packaging/%{alias}@.service %{buildroot}%{_unitdir}/%{alias}@.service
+install -m 0644 %{_builddir}/%{name}-%{version}/packaging/%{alias}-post@.service %{buildroot}%{_unitdir}/%{alias}-post@.service
+install -m 0644 %{_builddir}/%{name}-%{version}/packaging/%{alias}-ondemand@.service %{buildroot}%{_unitdir}/%{alias}-ondemand@.service
+install -m 0644 %{_builddir}/%{name}-%{version}/packaging/%{alias}@.socket %{buildroot}%{_unitdir}/%{alias}@.socket
+
 ln -s ../%{alias}.service %{buildroot}%{_unitdir_user}/basic.target.wants/%{alias}.service
 ln -s ../%{alias}-post.service %{buildroot}%{_unitdir_user}/default.target.wants/%{alias}-post.service
 ln -s ../%{alias}.socket %{buildroot}%{_unitdir_user}/sockets.target.wants/%{alias}.socket
 
+ln -s ../%{alias}@.service %{buildroot}%{_unitdir}/user-basic@.target.wants/%{alias}@.service
+ln -s ../%{alias}-post@.service %{buildroot}%{_unitdir}/user-default@.target.wants/%{alias}-post@.service
+ln -s ../%{alias}@.socket %{buildroot}%{_unitdir}/user-sockets@.target.wants/%{alias}@.socket
+
 %post
 /sbin/ldconfig
 mkdir -p /opt/share/.elementary
@@ -61,6 +73,8 @@ chsmack -t /opt/share/.elementary
 /sbin/ldconfig
 rm -f %{buildroot}%{_unitdir_user}/basic.target.wants/%{alias}.service
 rm -f %{buildroot}%{_unitdir_user}/default.target.wants/%{alias}-post.service
+rm -f %{buildroot}%{_unitdir}/user-basic@.target.wants/%{alias}@.service
+rm -f %{buildroot}%{_unitdir}/user-default@.target.wants/%{alias}-post@.service
 
 %files
 %defattr(-,root,root,-)
@@ -72,4 +86,11 @@ rm -f %{buildroot}%{_unitdir_user}/default.target.wants/%{alias}-post.service
 %{_unitdir_user}/default.target.wants/%{alias}-post.service
 %{_unitdir_user}/sockets.target.wants/%{alias}.socket
 %{_unitdir_user}/%{alias}.socket
+%{_unitdir}/%{alias}@.service
+%{_unitdir}/%{alias}-post@.service
+%{_unitdir}/%{alias}-ondemand@.service
+%{_unitdir}/user-basic@.target.wants/%{alias}@.service
+%{_unitdir}/user-default@.target.wants/%{alias}-post@.service
+%{_unitdir}/user-sockets@.target.wants/%{alias}@.socket
+%{_unitdir}/%{alias}@.socket
 %manifest %{alias}.manifest
diff --git a/packaging/efl-config@.service.in b/packaging/efl-config@.service.in
new file mode 100644 (file)
index 0000000..d2c7cb6
--- /dev/null
@@ -0,0 +1,16 @@
+[Unit]
+PartOf=userlogin@%i.target
+Description=Change the efl configures.
+DefaultDependencies=no
+Before=starter@%i.service
+After=enlightenment-user@%i.service
+
+[Service]
+User=%i
+Environment=DBUS_SESSION_BUS_ADDRESS=kernel:path=/sys/fs/kdbus/%i-user/bus;unix:path=/run/user/%i/bus
+Environment=XDG_RUNTIME_DIR=/run/user/%i
+SmackProcessLabel=User
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/usr/bin/sh -c "while [ ! -f /run/.wm_ready ] ; do /usr/bin/sleep .1 ; done ; exec /usr/bin/efl_config"
+EnvironmentFile=-/run/tizen-system-env
diff --git a/packaging/efl-config@.socket b/packaging/efl-config@.socket
new file mode 100644 (file)
index 0000000..ab9f30b
--- /dev/null
@@ -0,0 +1,14 @@
+[Unit]
+PartOf=userlogin@%i.target
+DefaultDependencies=no
+After=systemd-logind.service
+Description=EFL Config Service socket
+
+[Socket]
+SocketUser=%i
+ListenStream=/run/user/%i/system_share/.efl-config.sock
+Service=efl-config-ondemand@%i.service
+SocketMode=0777
+
+[Install]
+WantedBy=user-sockets@.target