[PATCH] base-files: add option to make /var persistent

Adrian Schmutzler mail at adrianschmutzler.de
Sun Aug 22 06:45:40 PDT 2021


Hi,

> --- a/config/Config-images.in
> +++ b/config/Config-images.in
> @@ -303,4 +303,10 @@ menu "Target Images"
>  		  it will be mounted by PARTUUID which makes the kernel
> find the
>  		  appropriate disk automatically.
> 
> +	config TARGET_ROOTFS_PERSIST_VAR
> +		bool "Make /var persistent"
> +		default n
> +		help
> +		  Do not symlink /var to /tmp, so that its content will
> +		  persist across reboots.

I'd add information about /var/run here as well, just add something like "(/var/run will still be linked to /tmp/run)" ...
Otherwise, the description would be misleading.

Best

Adrian

>  endmenu
> diff --git a/package/base-files/Makefile b/package/base-files/Makefile index
> 5f816a0d1b..687fbc5f78 100644
> --- a/package/base-files/Makefile
> +++ b/package/base-files/Makefile
> @@ -172,8 +172,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 $(1)/var
> +	$(LN) /tmp/run $(1)/var/run
> +endif
>  	mkdir -p $(1)/etc
>  	$(LN) /tmp/resolv.conf /tmp/TZ /tmp/localtime $(1)/etc/
> 
> --
> 2.31.1
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20210822/51827ff5/attachment.sig>


More information about the openwrt-devel mailing list