Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Jan 2015 23:25:53 +0200
From:      Guy Yur <guyyur@gmail.com>
To:        freebsd-arch@freebsd.org, freebsd-rc@freebsd.org
Subject:   Populating /var from files or command
Message-ID:  <CAC67Hz-4nEZj1dNEspWg01aTF96NLqV7azqAxNZ5OhqjJsscTw@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
--001a11333f64a99707050c02739c
Content-Type: text/plain; charset=UTF-8

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

--001a11333f64a99707050c02739c
Content-Type: application/octet-stream; name="populate_var_files.patch"
Content-Disposition: attachment; filename="populate_var_files.patch"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_i4lrybyf0

SW5kZXg6IGV0Yy9kZWZhdWx0cy9yYy5jb25mCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIGV0Yy9kZWZhdWx0cy9y
Yy5jb25mCShyZXZpc2lvbiAyNzY3NTgpCisrKyBldGMvZGVmYXVsdHMvcmM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IC92YXIKK2FmdGVyIGl0IGhhcyBiZWVuIG1vdW50ZWQu
CisuSXQgVmEgcG9wdWxhdGVfdmFyX2NtZAorLlBxIFZ0IHN0cgorQ29tbWFuZCB0byBleGVjdXRl
IGFmdGVyCisuUGEgL3ZhcgoraGFzIGJlZW4gbW91bnRlZC4KK05vdGUgdGhhdCB0aGUgY29tbWFu
ZCBpcyBwYXNzZWQgdG8KKy5JYyBldmFsLgogLkl0IFZhIGNsZWFudmFyX2VuYWJsZQogLlBxIFZ0
IGJvb2wKIENsZWFuIHRoZQo=
--001a11333f64a99707050c02739c--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAC67Hz-4nEZj1dNEspWg01aTF96NLqV7azqAxNZ5OhqjJsscTw>