@@ -29,15 +29,14 @@ else
# a real (but empty) directory, and the "factory files" will be copied
# back there by the tmpfiles.d mechanism.
define SKELETON_INIT_SYSTEMD_ROOT_RO_OR_RW
- mkdir -p $(TARGET_DIR)/etc/systemd/tmpfiles.d
echo "/dev/root / auto ro 0 1" >$(TARGET_DIR)/etc/fstab
- echo "tmpfs /var tmpfs mode=1777 0 0" >>$(TARGET_DIR)/etc/fstab
endef
define SKELETON_INIT_SYSTEMD_PRE_ROOTFS_VAR
rm -rf $(TARGET_DIR)/usr/share/factory/var
mv $(TARGET_DIR)/var $(TARGET_DIR)/usr/share/factory/var
mkdir -p $(TARGET_DIR)/var
+ mkdir -p $(TARGET_DIR)/usr/lib/tmpfiles.d
for i in $(TARGET_DIR)/usr/share/factory/var/* \
$(TARGET_DIR)/usr/share/factory/var/lib/* \
$(TARGET_DIR)/usr/share/factory/var/lib/systemd/*; do \
@@ -51,7 +50,9 @@ define SKELETON_INIT_SYSTEMD_PRE_ROOTFS_VAR
printf "C! %s - - - -\n" "$${j}" \
|| exit 1; \
fi; \
- done >$(TARGET_DIR)/etc/tmpfiles.d/var-factory.conf
+ done >$(TARGET_DIR)/usr/lib/tmpfiles.d/buildroot-factory.conf
+ $(INSTALL) -D -m 0644 $(SKELETON_INIT_SYSTEMD_PKGDIR)/var.mount \
+ $(TARGET_DIR)/usr/lib/systemd/system/var.mount
endef
SKELETON_INIT_SYSTEMD_ROOTFS_PRE_CMD_HOOKS += SKELETON_INIT_SYSTEMD_PRE_ROOTFS_VAR
new file mode 100644
@@ -0,0 +1,18 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+# Modelled after systemd's tmp.mount
+
+[Unit]
+Description=Buildroot /var tmpfs
+DefaultDependencies=no
+Conflicts=umount.target
+Before=basic.target local-fs.target umount.target systemd-tmpfiles-setup.service
+After=swap.target
+
+[Mount]
+What=tmpfs
+Where=/var
+Type=tmpfs
+Options=mode=1777,strictatime,nosuid,nodev,size=50%%,nr_inodes=1m
+
+[Install]
+WantedBy=basic.target