Add tbm-drm service file 30/60730/1
authorChangyeon Lee <cyeon.lee@samsung.com>
Mon, 29 Feb 2016 12:15:56 +0000 (21:15 +0900)
committerChangyeon Lee <cyeon.lee@samsung.com>
Mon, 29 Feb 2016 12:15:56 +0000 (21:15 +0900)
Change-Id: I7d42b03523e573cc4b78c3577378f3211f831526

packaging/libtbm.spec
service/tbm-drm-user.path [new file with mode: 0644]
service/tbm-drm-user.service [new file with mode: 0644]
service/tbm-drm.path [new file with mode: 0644]
service/tbm-drm.service [new file with mode: 0644]

index 35b62c8..b2d5a80 100644 (file)
@@ -53,12 +53,27 @@ cp -af COPYING %{buildroot}/usr/share/license/%{name}
 %make_install
 
 
+%__mkdir_p %{buildroot}%{_unitdir}
+install -m 644 service/tbm-drm.service %{buildroot}%{_unitdir}
+install -m 644 service/tbm-drm.path %{buildroot}%{_unitdir}
+%__mkdir_p %{buildroot}%{_unitdir_user}
+install -m 644 service/tbm-drm-user.service %{buildroot}%{_unitdir_user}
+install -m 644 service/tbm-drm-user.path %{buildroot}%{_unitdir_user}
+
 %clean
 rm -rf %{buildroot}
 
+%pre
+%__mkdir_p %{_unitdir}/graphical.target.wants
+ln -sf ../tbm-drm.path %{_unitdir}/graphical.target.wants/
+
+%__mkdir_p %{_unitdir_user}/default.target.wants
+ln -sf ../tbm-drm-user.path %{_unitdir_user}/default.target.wants/
+
 %post -p /sbin/ldconfig
 %postun -p /sbin/ldconfig
-
+rm -f %{_unitdir}/graphical.target.wants/tbm-drm.path
+rm -f %{_unitdir_user}/default.target.wants/tbm-drm-user.path
 
 %files
 %manifest %{name}.manifest
@@ -77,5 +92,9 @@ rm -rf %{buildroot}
 %{_includedir}/tbm_bufmgr_backend.h
 %{_includedir}/tbm_type.h
 %{_includedir}/tbm_drm_helper.h
+%{_unitdir}/tbm-drm.path
+%{_unitdir}/tbm-drm.service
+%{_unitdir_user}/tbm-drm-user.path
+%{_unitdir_user}/tbm-drm-user.service
 %{_libdir}/libtbm.so
 %{_libdir}/pkgconfig/libtbm.pc
diff --git a/service/tbm-drm-user.path b/service/tbm-drm-user.path
new file mode 100644 (file)
index 0000000..ede1f1b
--- /dev/null
@@ -0,0 +1,5 @@
+[Unit]
+Description=Wait for tbm-drm display daemon socket
+
+[Path]
+PathExists=/run/tbm_drm
diff --git a/service/tbm-drm-user.service b/service/tbm-drm-user.service
new file mode 100644 (file)
index 0000000..b0ca295
--- /dev/null
@@ -0,0 +1,6 @@
+[Unit]
+Description=Creating a link file for user to access tbm_drm
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/ln -sf /run/tbm_drm /run/user/%U/
diff --git a/service/tbm-drm.path b/service/tbm-drm.path
new file mode 100644 (file)
index 0000000..c0cd484
--- /dev/null
@@ -0,0 +1,5 @@
+[Unit]
+Description=Wait for tbm_drm daemon socket
+
+[Path]
+PathExists=/run/tbm_drm
diff --git a/service/tbm-drm.service b/service/tbm-drm.service
new file mode 100644 (file)
index 0000000..435aea1
--- /dev/null
@@ -0,0 +1,11 @@
+[Unit]
+Description=Display manager setup service
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/chmod g+w /run/tbm_drm
+ExecStart=/usr/bin/chgrp display /run/tbm_drm
+ExecStart=/usr/bin/chsmack -a User /run/tbm_drm
+
+[Install]
+WantedBy=graphical.target