<title>Description</title>
<para>
- Initialize an empty physical root filesystem in the designated PATH, with normal toplevels and correct permissions for each directory. Primarily useful for operating system installers.
+ Initialize an empty physical root filesystem in the designated PATH, with normal toplevels and correct permissions for each directory.
+ Primarily useful for operating system installers.
</para>
</refsect1>
+
+ <refsect1>
+ <title>Options</title>
+
+ <variablelist>
+ <varlistentry>
+ <term><option>--modern</option></term>
+ <listitem><para>
+ Equivalent to <literal>--epoch=1</literal>.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--epoch</option></term>
+ <listitem><para>
+ This accepts an integer value in the range [0-1], inclusive. The default is zero
+ for compatibility.
+ </para>
+ <para>
+ When set to 1, the command will skip adding a number of toplevel "API filesystems"
+ such as <literal>/proc</literal>
+ to the toplevel of the physical root. These should be unnecessary, as they
+ should only be mounted in the final deployment root. The main exception
+ is <literal>/boot</literal>, which may need to be mounted in some setups
+ before the target root.
+ </para></listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect1>
+
<refsect1>
<title>Example</title>
<para><command>$ mkdir /example</command></para>
- <para><command>$ ostree admin init-fs /example</command></para>
+ <para><command>$ ostree admin init-fs --epoch=1 /example</command></para>
<para><command>$ ls /example </command></para>
<para>
- <emphasis>boot</emphasis> <emphasis>dev</emphasis> <emphasis>home</emphasis> <emphasis>ostree</emphasis> <emphasis>proc</emphasis> <emphasis>root</emphasis> <emphasis>run</emphasis> <emphasis>sys</emphasis> <emphasis>tmp</emphasis>
+ <emphasis>boot</emphasis>
</para>
</refsect1>
</refentry>
#include <glib/gi18n.h>
static gboolean opt_modern;
+static gint opt_epoch;
static GOptionEntry options[]
= { { "modern", 0, 0, G_OPTION_ARG_NONE, &opt_modern, "Only create /boot and /ostree", NULL },
+ { "epoch", 'E', 0, G_OPTION_ARG_INT, &opt_epoch,
+ "An integer value, defines initial state. Must be in the range [0-1], inclusive.",
+ NULL },
{ NULL } };
gboolean
if (!glnx_shutil_mkdir_p_at (root_dfd, "boot", 0755, cancellable, error))
return FALSE;
+ if (opt_epoch < 0)
+ return glnx_throw (error, "Invalid epoch: %d", opt_epoch);
+
+ /* --modern is equivalent to --epoch=1 */
+ if (opt_modern && opt_epoch == 0)
+ opt_epoch = 1;
+
/* See https://github.com/coreos/coreos-assembler/pull/688
* For Fedora CoreOS at least, we have this now to the point where we don't
* need this stuff in the physical sysroot. I'm not sure we ever really did,
* but to be conservative, make it opt-in to the new model of just boot/ and ostree/.
*/
- if (!opt_modern)
+ if (opt_epoch == 0)
{
const char *traditional_toplevels[] = { "boot", "dev", "home", "proc", "run", "sys" };
for (guint i = 0; i < G_N_ELEMENTS (traditional_toplevels); i++)
echo "1..$((31 + ${extra_admin_tests:-0}))"
-mkdir sysrootmin
-${CMD_PREFIX} ostree admin init-fs --modern sysrootmin
-assert_has_dir sysrootmin/boot
-assert_has_dir sysrootmin/ostree/repo
-assert_not_has_dir sysrootmin/home
-rm sysrootmin -rf
-echo "ok init-fs --modern"
+for flag in --modern --epoch=1; do
+ mkdir sysrootmin
+ ${CMD_PREFIX} ostree admin init-fs --modern sysrootmin
+ assert_has_dir sysrootmin/boot
+ assert_has_dir sysrootmin/ostree/repo
+ assert_not_has_dir sysrootmin/home
+ rm sysrootmin -rf
+done
+echo "ok init-fs"
function validate_bootloader() {
cd ${test_tmpdir};