From owner-freebsd-arch@FreeBSD.ORG Tue Jan 6 21:25:54 2015 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8D76751C; Tue, 6 Jan 2015 21:25:54 +0000 (UTC) Received: from mail-yh0-x22d.google.com (mail-yh0-x22d.google.com [IPv6:2607:f8b0:4002:c01::22d]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4A82C64D3B; Tue, 6 Jan 2015 21:25:54 +0000 (UTC) Received: by mail-yh0-f45.google.com with SMTP id f10so44675yha.18; Tue, 06 Jan 2015 13:25:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=QweXJqEqC6t2TCjajJIwiUytgJj5Z6Ti3ExZQVjFW80=; b=PGqpBzTPnYSRjKeB2Udj6p0qh30vnGQbNe3ypOxbqnflRwzXrtKbKR/hLQzhmvAv0y Qeu1ej8KEACW+kKMzh/5UsKGLR/gzk3AIfQZKtAfEXwe+fOkXgdJ4XCVh1FaXJlHyF+C hb7Qqbai+cXLaSkOjBUL4vcBAfYixqyH81Hu5TSWmV+emOYs/NNQHV68nAuHqm430zdH DnUPegyjvFDyoIwS5T1nOsz0AfPCHY6wd2uYzuwNJg8KsqMg2hC6YHvAFD5Fk0D7JAW6 4jXkIUInvNT3DqtAh6GaxE5LGDEbNjTH7hiQvsUp+Vgzos38VEtxW8YLx5AzE7r2vhIu 5Wbw== MIME-Version: 1.0 X-Received: by 10.236.1.97 with SMTP id 61mr36608840yhc.78.1420579553504; Tue, 06 Jan 2015 13:25:53 -0800 (PST) Received: by 10.170.186.214 with HTTP; Tue, 6 Jan 2015 13:25:53 -0800 (PST) Date: Tue, 6 Jan 2015 23:25:53 +0200 Message-ID: Subject: Populating /var from files or command From: Guy Yur To: freebsd-arch@freebsd.org, freebsd-rc@freebsd.org Content-Type: multipart/mixed; boundary=001a11333f64a99707050c02739c X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jan 2015 21:25:54 -0000 --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_files) 3. populate_var_cmd Command to run to populate /var (similar to mdconfig_md_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 Yy5jb25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