Populating /var from files or command

Guy Yur guyyur at gmail.com
Tue Jan 6 21:25:54 UTC 2015


Hi,

What do you think about adding support to var rc script
to populate /var from files or command?

Attached patch adds three variables:
1. populate_var_mtree_enable
   Enable/disable populating /var from mtree.
   Defaults to YES to keep current behavior.

2. populate_var_files
   Files to be copied to /var (similar to mdconfig_md<X>_files)

3. populate_var_cmd
   Command to run to populate /var (similar to mdconfig_md<X>_cmd)

There is one behavior change.  If you set populate_var="YES" with
mtree and /usr fails to mount, the script will now exit with error.
If there is a use case for a non-empty /var, a separate /usr
and still wanting to set populate_var="YES" I can modify the
checks.


Some examples:
Keeping a var.tgz on a read-only root file system and extracting it.
/var is tmpfs specified in /etc/fstab or varmfs.
populate_var="YES"
populate_var_cmd="/usr/bin/tar xfzC /etc/var.tgz /var"
(add "mount /usr && " before tar if /usr is a separate file system)

Keeping a var source dir on root and copying the files from it.
Mtree can be skipped if the source dir contains all the subdirs.
populate_var="YES"
populate_var_mtree_enable="NO"
populate_var_files="/etc/var/*" or populate_var_files="/_var/*"


- Guy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: populate_var_files.patch
Type: application/octet-stream
Size: 3551 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20150106/1a6106c1/attachment.obj>


More information about the freebsd-arch mailing list