system-plugin: Generate tizen environment service file 69/37669/2
authorJiyoung Yun <jy910.yun@samsung.com>
Thu, 2 Apr 2015 07:05:06 +0000 (16:05 +0900)
committerJiyoung Yun <jy910.yun@samsung.com>
Thu, 2 Apr 2015 07:25:01 +0000 (16:25 +0900)
Some important daemons need system-level shared environment variables
such as DISPLAY. For this purpose, this patch generates the Environment
file for system daemon.

Change-Id: I995852d6537fbe6932ffff801b5f9e28635a76f4
Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
packaging/system-plugin.spec
units/tizen-system-env.service [new file with mode: 0644]

index 0d59307..169b569 100644 (file)
@@ -39,12 +39,14 @@ cp %{SOURCE1} .
 %install
 mkdir -p %{buildroot}%{_unitdir}
 install -m 644 units/resize2fs@.service %{buildroot}%{_unitdir}
+install -m 644 units/tizen-system-env.service %{buildroot}%{_unitdir}
 
 # Resize partition for 3-parted target
 mkdir -p %{buildroot}%{_unitdir}/basic.target.wants
 ln -s ../resize2fs@.service %{buildroot}%{_unitdir}/basic.target.wants/resize2fs@dev-disk-by\\x2dlabel-system\\x2ddata.service
 ln -s ../resize2fs@.service %{buildroot}%{_unitdir}/basic.target.wants/resize2fs@dev-disk-by\\x2dlabel-user.service
 ln -s ../resize2fs@.service %{buildroot}%{_unitdir}/basic.target.wants/resize2fs@dev-disk-by\\x2dlabel-rootfs.service
+ln -s ../tizen-system-env.service %{buildroot}%{_unitdir}/basic.target.wants/tizen-system-env.service
 
 mkdir -p %{buildroot}%{_libdir}/udev/rules.d/
 install -m 644 rules/51-system-plugin-exynos.rules %{buildroot}%{_libdir}/udev/rules.d/
@@ -56,6 +58,8 @@ systemctl daemon-reload
 %manifest %{name}.manifest
 %license LICENSE.Apache-2.0
 %{_unitdir}/resize2fs@.service
+%{_unitdir}/tizen-system-env.service
+%{_unitdir}/basic.target.wants/tizen-system-env.service
 
 %files u3
 %manifest %{name}.manifest
diff --git a/units/tizen-system-env.service b/units/tizen-system-env.service
new file mode 100644 (file)
index 0000000..dc4e188
--- /dev/null
@@ -0,0 +1,11 @@
+[Unit]
+Description=Generate environment from /etc/profile.d
+DefaultDependencies=no
+Before=basic.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/env -i sh -c 'source /etc/profile; env | /bin/egrep -v "^(HOME|PWD|SHLVL|_|USER|MAIL|LOGNAME)=" > /run/tizen-system-env'
+
+[Install]
+WantedBy=basic.target