Bläddra i källkod

package/mender: remove /var/lib/mender symlinking

The logic behind making /var/lib/mender a symlink to itself is to
detect if a filesystem is read-only. However, this creates a few problems:

  1) The logic confusing.

  2) The official mender documentation suggests four partitions minimum:
     - boot
     - rootfs A
     - rootfs B
     - data

     If a user is to follow the official documentation, which they should,
     then there is no need for any additional logic for a system setup with
     a read-only filesystem, as the data partition is always read-write.

  3) The post-build.sh script in the board/mender/x86_64 directory removes
     the symlink.

  - Remove symlinking /var/lib/mender to itself

  - Remove the difficult to understand logic dealing with the symlinks
    in S42mender, mender-client.service.

  - Remove the logic dealing with the symlink in
    board/mender/x86_64/post-build.sh

Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
Adam Duskett 9 månader sedan
förälder
incheckning
9320989053

+ 0 - 5
board/mender/x86_64/post-build.sh

@@ -31,11 +31,6 @@ parse_args() {
 # Create a persistent directory to mount the data partition at.
 # Create a persistent directory to mount the data partition at.
 mender_fixup() {
 mender_fixup() {
     pushd "${TARGET_DIR}"
     pushd "${TARGET_DIR}"
-    if [[ -L var/lib/mender ]]; then
-        rm var/lib/mender
-        mkdir -p var/lib/mender
-    fi
-
     # The common paradigm is to have the persistent data volume at /data for mender.
     # The common paradigm is to have the persistent data volume at /data for mender.
     if [[ ! -L data ]]; then
     if [[ ! -L data ]]; then
         ln -s var/lib/mender data
         ln -s var/lib/mender data

+ 0 - 16
package/mender/S42mender

@@ -8,22 +8,6 @@ PIDFILE="/var/run/${DAEMON}.pid"
 DAEMON_ARGS="daemon"
 DAEMON_ARGS="daemon"
 
 
 start() {
 start() {
-	# If /var/lib/mender is a symlink to /var/run/mender, and
-	#   - the filesystem is RO (i.e. we can not rm the symlink),
-	#     create the directory pointed to by the symlink.
-	#   - the filesystem is RW (i.e. we can rm the symlink),
-	#     replace the symlink with an actual directory
-	if [ -L /var/lib/mender ] && [ "$(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
-
 	printf "Starting mender service: "
 	printf "Starting mender service: "
 	umask 077
 	umask 077
 	start-stop-daemon -bmSqp "$PIDFILE" -x ${DAEMON_PATH} -- ${DAEMON_ARGS}
 	start-stop-daemon -bmSqp "$PIDFILE" -x ${DAEMON_PATH} -- ${DAEMON_ARGS}

+ 0 - 11
package/mender/mender-client.service

@@ -6,17 +6,6 @@ After=systemd-resolved.service
 Type=idle
 Type=idle
 User=root
 User=root
 Group=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
 ExecStart=/usr/bin/mender daemon
 Restart=on-abort
 Restart=on-abort
 
 

+ 1 - 2
package/mender/mender.mk

@@ -72,8 +72,7 @@ define MENDER_INSTALL_CONFIG_FILES
 	$(INSTALL) -D -m 0755 $(MENDER_PKGDIR)/device_type \
 	$(INSTALL) -D -m 0755 $(MENDER_PKGDIR)/device_type \
 			$(TARGET_DIR)/etc/mender/device_type
 			$(TARGET_DIR)/etc/mender/device_type
 
 
-	mkdir -p $(TARGET_DIR)/var/lib
-	ln -snf /var/run/mender $(TARGET_DIR)/var/lib/mender
+	mkdir -p $(TARGET_DIR)/var/lib/mender
 	$(foreach f,$(MENDER_UPDATE_MODULES_FILES), \
 	$(foreach f,$(MENDER_UPDATE_MODULES_FILES), \
 		$(INSTALL) -D -m 0755 $(@D)/support/modules/$(notdir $(f)) \
 		$(INSTALL) -D -m 0755 $(@D)/support/modules/$(notdir $(f)) \
 			$(TARGET_DIR)/usr/share/mender/modules/v3/$(notdir $(f))
 			$(TARGET_DIR)/usr/share/mender/modules/v3/$(notdir $(f))