sys-apps/fwupd: Update start/stop stanzas for fwupd.conf

This change alters when the daemon will be stopped. This will ensure
that we can complete a reboot even if the ui was stopped before the
service started.


Change-Id: Ib836daef45f704a7d8772d32903d96bb1be7d544
Tested-by: Daniel Campello <>
Auto-Submit: Daniel Campello <>
Commit-Queue: Daniel Campello <>
Commit-Queue: Benson Leung <>
Reviewed-by: Benson Leung <>
Reviewed-by: Sarthak Kukreti <>
diff --git a/sys-apps/fwupd/files/fwupd.conf b/sys-apps/fwupd/files/fwupd.conf
index f9e9a98..b6123ff 100644
--- a/sys-apps/fwupd/files/fwupd.conf
+++ b/sys-apps/fwupd/files/fwupd.conf
@@ -5,8 +5,8 @@
 description    "Fwupd daemon"
 author         ""
-# The service is started by Chrome via UpstartClient::StartAuthPolicyService().
-stop on stopping ui
+# The service is started via DBus activation.
+stop on stopping system-services
 env CACHE_DIRECTORY="/var/cache/fwupd"
@@ -14,6 +14,15 @@
 pre-start script
   mkdir -p /var/cache/fwupd /var/lib/fwupd
   chown -R fwupd:fwupd /var/cache/fwupd /var/lib/fwupd
+  # Check if system-services is still running before starting.
+  # This is to prevent new dbus-activated instances from getting started once
+  # the system is beginning to shut down.
+  if ! initctl status system-services | grep -q running; then
+    logger -t "${UPSTART_JOB}" "ERROR: system services not running, quit."
+    stop
+    exit 0
+  fi
 end script