HACK: to make sure amd started after xorg server
authorYin Kangkai <kangkai.yin@intel.com>
Mon, 19 Nov 2012 09:10:05 +0000 (17:10 +0800)
committerYin Kangkai <kangkai.yin@intel.com>
Mon, 19 Nov 2012 09:10:05 +0000 (17:10 +0800)
As said in previous commits, we have to move back ac.service from user session
to system. However since ac.service depends on xorg, and xorg is in user
session, we have to use *busy* checking /tmp/.X0-lock before we starts. This
is ugly, but at least a reasonable fix for now.

(If anyone has better solution, please go ahead to fix this.)

Also, both launchpad-preload@.service and ac.service are actually part of
graphical.target, not multi-user.target.

Change-Id: I37703578871c507d2d4c3c6d9e705e7784109396
Signed-off-by: Yin Kangkai <kangkai.yin@intel.com>
packaging/ac.service
packaging/aul.spec
packaging/launchpad-preload@.service

index 6ff0443..2b7bbcd 100644 (file)
@@ -6,10 +6,11 @@
 Description=Start the Access Control server
 
 [Service]
+Environment=DISPLAY=:0
 ExecStartPre=-/bin/mkdir -m 1777 /tmp/alaunch
-ExecStart=/usr/bin/amd
+ExecStart=/bin/sh -c 'while test ! -e /tmp/.X0-lock; do sleep 0.1; done; exec /usr/bin/amd'
 
 OOMScoreAdjust=-100
 
 [Install]
-WantedBy=multi-user.target
+WantedBy=graphical.target
index 80b6db8..b8cc85d 100644 (file)
@@ -71,11 +71,11 @@ mkdir -p %{buildroot}/opt/dbspace
 sqlite3 %{buildroot}/opt/dbspace/.mida.db < %{buildroot}/usr/share/aul/mida_db.sql
 rm -rf %{buildroot}/usr/share/aul/mida_db.sql
 
-mkdir -p %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants
+mkdir -p %{buildroot}%{_libdir}/systemd/system/graphical.target.wants
 install -m 0644 %SOURCE101 %{buildroot}%{_libdir}/systemd/system/launchpad-preload@.service
 install -m 0644 %SOURCE102 %{buildroot}%{_libdir}/systemd/system/ac.service
-ln -s ../launchpad-preload@.service %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/launchpad-preload@app.service
-ln -s ../ac.service %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/ac.service
+ln -s ../launchpad-preload@.service %{buildroot}%{_libdir}/systemd/system/graphical.target.wants/launchpad-preload@app.service
+ln -s ../ac.service %{buildroot}%{_libdir}/systemd/system/graphical.target.wants/ac.service
 
 
 %preun
@@ -114,8 +114,8 @@ systemctl daemon-reload
 /usr/share/aul/preload_list.txt
 /usr/share/aul/preexec_list.txt
 %{_bindir}/launchpad_preloading_preinitializing_daemon
-%{_libdir}/systemd/system/multi-user.target.wants/launchpad-preload@app.service
-%{_libdir}/systemd/system/multi-user.target.wants/ac.service
+%{_libdir}/systemd/system/graphical.target.wants/launchpad-preload@app.service
+%{_libdir}/systemd/system/graphical.target.wants/ac.service
 %{_libdir}/systemd/system/launchpad-preload@.service
 %{_libdir}/systemd/system/ac.service
 /usr/bin/amd
index 3ce1144..5b06a81 100644 (file)
@@ -9,4 +9,4 @@ Environment=XDG_RUNTIME_DIR=/run/user/%I
 ExecStart=/usr/bin/launchpad_preloading_preinitializing_daemon
 
 [Install]
-WantedBy=multi-user.target
+WantedBy=graphical.target