package/mender: Fix incorrectly named service file
authorAdam Duskett <Aduskett@gmail.com>
Fri, 28 Aug 2020 17:08:44 +0000 (10:08 -0700)
committerPeter Korsgaard <peter@korsgaard.com>
Fri, 28 Aug 2020 20:36:49 +0000 (22:36 +0200)
Many of the mender CLI commands use systemctl commands to get information about
the daemon, such as the PID (IE: systemctl show -p MainPID mender-client).
As seen above, these commands expect the service file to be named
"mender-client" instead of "mender."

As such, in the current state, running a forced update check in the CLI will
result in the following error:
failed to force updateCheck: could not find the PID of the mender daemon.

Changing the name of mender.service to mender-client.service fixes the issue.

Signed-off-by: Adam Duskett <Aduskett@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
package/mender/mender-client.service [new file with mode: 0644]
package/mender/mender.mk
package/mender/mender.service [deleted file]

diff --git a/package/mender/mender-client.service b/package/mender/mender-client.service
new file mode 100644 (file)
index 0000000..2a5f476
--- /dev/null
@@ -0,0 +1,24 @@
+[Unit]
+Description=Mender OTA update service
+After=systemd-resolved.service
+
+[Service]
+Type=idle
+User=root
+Group=root
+ExecStartPre=/bin/sh -c '\
+if [ -L /var/lib/mender \
+     -a "$(readlink /var/lib/mender)" = "/var/run/mender" ]; then \
+    if rm -f /var/lib/mender >/dev/null 2>&1; then \
+        mkdir -p /var/lib/mender; \
+    else \
+        echo "No persistent location to store mender data. Data will be lost" \
+        echo "at reboot. Are you sure this is what you want to do?"; \
+        mkdir -p "$(readlink /var/lib/mender)"; \
+    fi; \
+fi'
+ExecStart=/usr/bin/mender -daemon
+Restart=on-abort
+
+[Install]
+WantedBy=multi-user.target
index 325141787e1caecc6220431bcdf4ffea6d4195c5..ca24b853b51baf40333dfab7c2eaf55115f76ebe 100644 (file)
@@ -77,8 +77,8 @@ endef
 MENDER_POST_INSTALL_TARGET_HOOKS += MENDER_INSTALL_CONFIG_FILES
 
 define MENDER_INSTALL_INIT_SYSTEMD
-       $(INSTALL) -D -m 0644 $(MENDER_PKGDIR)/mender.service \
-               $(TARGET_DIR)/usr/lib/systemd/system/mender.service
+       $(INSTALL) -D -m 0644 $(MENDER_PKGDIR)/mender-client.service \
+               $(TARGET_DIR)/usr/lib/systemd/system/mender-client.service
 endef
 
 define MENDER_INSTALL_INIT_SYSV
diff --git a/package/mender/mender.service b/package/mender/mender.service
deleted file mode 100644 (file)
index 2a5f476..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-[Unit]
-Description=Mender OTA update service
-After=systemd-resolved.service
-
-[Service]
-Type=idle
-User=root
-Group=root
-ExecStartPre=/bin/sh -c '\
-if [ -L /var/lib/mender \
-     -a "$(readlink /var/lib/mender)" = "/var/run/mender" ]; then \
-    if rm -f /var/lib/mender >/dev/null 2>&1; then \
-        mkdir -p /var/lib/mender; \
-    else \
-        echo "No persistent location to store mender data. Data will be lost" \
-        echo "at reboot. Are you sure this is what you want to do?"; \
-        mkdir -p "$(readlink /var/lib/mender)"; \
-    fi; \
-fi'
-ExecStart=/usr/bin/mender -daemon
-Restart=on-abort
-
-[Install]
-WantedBy=multi-user.target