Add build Option for multi-user support
[platform/framework/web/wrt.git] / packaging / wrt.spec
index 36117a8..756f857 100644 (file)
@@ -1,5 +1,7 @@
 %bcond_with wayland
 %bcond_with decrypt
+%bcond_with multi_user
+
 Name:       wrt
 Summary:    Web runtime
 Version:    0.8.198.3
@@ -9,7 +11,10 @@ License:    Apache-2.0
 URL:        N/A
 Source0:    %{name}-%{version}.tar.gz
 ## wrt-launchpad-daemon #######################################################
+### systemd service for mono-user mode
 Source101:  wrt_launchpad_daemon@.service
+### systemd service for multi-user mode
+Source102:  wrt_launchpad_daemon_user.service
 Source1001:    wrt.manifest
 ###############################################################################
 
@@ -104,6 +109,11 @@ export LDFLAGS+="-Wl,--rpath=%{_libdir}"
 %else
          -DDECRYPT_SUPPORT=Off \
 %endif
+%if %{with multi_user}
+         -DMULTI_USER_SUPPORT=On \
+%else
+         -DMULTI_USER_SUPPORT=Off \
+%endif
 
         %{?WITH_TESTS:-DWITH_TESTS=%WITH_TESTS}
 
@@ -124,16 +134,35 @@ ln -sf ../../init.d/wrt_launchpad_run.sh %{buildroot}/%{_sysconfdir}/rc.d/rc3.d/
 ln -sf ../../init.d/wrt_launchpad_run.sh %{buildroot}/%{_sysconfdir}/rc.d/rc4.d/S80wrt_launchpad_run
 
 #systemd
+
+%if %{with multi_user}
+mkdir -p %{buildroot}%{_unitdir_user}/tizen-middleware.target.wants/
+install -m 0644 %SOURCE102 %{buildroot}%{_unitdir_user}/wrt_launchpad_daemon.service
+ln -s ../wrt_launchpad_daemon.service %{buildroot}%{_unitdir_user}/tizen-middleware.target.wants/wrt_launchpad_daemon.service
+%else
 mkdir -p %{buildroot}%{_unitdir}/graphical.target.wants
 install -m 0644 %SOURCE101 %{buildroot}%{_unitdir}/wrt_launchpad_daemon@.service
 ln -s ../wrt_launchpad_daemon@.service %{buildroot}%{_unitdir}/graphical.target.wants/wrt_launchpad_daemon@app.service
+%endif
 
 %preun
 if [ $1 == 0 ]; then
-    systemctl stop wrt_launchpad_daemon@app.service
+%if %{with multi_user}
+       systemctl --user stop wrt_launchpad_daemon.service
+%else
+       systemctl stop wrt_launchpad_daemon@app.service
+%endif
+
 fi
+
+
+
+
 ###############################################################################
 
+
+
+
 %clean
 rm -rf %{buildroot}
 
@@ -146,7 +175,13 @@ chmod +s /usr/bin/wrt-launcher
 /sbin/ldconfig
 systemctl daemon-reload
 if [ $1 == 1 ]; then
+%if %{with multi_user}
+    systemctl --user restart wrt_launchpad_daemon.service
+%else
     systemctl restart wrt_launchpad_daemon@app.service
+%endif
+
+
 fi
 ###############################################################################
 
@@ -187,8 +222,14 @@ systemctl daemon-reload
 /etc/smack/accesses2.d/wrt_launchpad_daemon.rule
 /opt/etc/smack/accesses.d/wrt_launchpad_daemon.rule
 #systemd
+%if %{with multi_user}
+%{_unitdir_user}/tizen-middleware.target.wants/wrt_launchpad_daemon.service
+%{_unitdir_user}/wrt_launchpad_daemon.service
+%else
 %{_unitdir}/graphical.target.wants/wrt_launchpad_daemon@app.service
 %{_unitdir}/wrt_launchpad_daemon@.service
+%endif
+
 ###############################################################################
 
 %files devel