From 57807f50ded6cf0996284a850084183af13d5894 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Mon, 25 Feb 2019 15:05:07 +0200 Subject: base-files: add option to make /var persistent In OpenWrt, /var is symlinked to /tmp by default. This is done to reduce the amount of writes to the flash chip, which often have not the greatest durability. As a result, things like DHCP or UPnP lease files, are not persistent across reboots. Since OpenWrt can run on devices with more durable storage, it makes sense to have an option for a persistent /var. Add an option to make /var persistent. When enabled, /var will no longer be symlinked to /tmp, but /var/run will be symlink to /tmp/run, as it should contains only files that should not be kept during reboot. The option is off by default, to maintain the current behaviour. Signed-off-by: Stijn Tintel --- package/base-files/Makefile | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'package/base-files') diff --git a/package/base-files/Makefile b/package/base-files/Makefile index d67f551b9c..6da3df2b4e 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -181,8 +181,13 @@ define Package/base-files/install mkdir -p $(1)/www mkdir -p $(1)/root $(LN) /proc/mounts $(1)/etc/mtab +ifeq ($(CONFIG_TARGET_ROOTFS_PERSIST_VAR),n) rm -f $(1)/var $(LN) tmp $(1)/var +else + mkdir -p $(1)/var + $(LN) /tmp/run $(1)/var/run +endif mkdir -p $(1)/etc $(LN) /tmp/resolv.conf /tmp/TZ /tmp/localtime $(1)/etc/ -- cgit v1.2.3