mirror of
https://github.com/ostreedev/ostree.git
synced 2025-01-05 13:18:17 +03:00
Merge pull request #2990 from cgwalters/init-is-stateroot
Two s/osname/stateroot/ patches
This commit is contained in:
commit
f7786e759f
@ -26,7 +26,7 @@ if ENABLE_MAN
|
|||||||
# ostree.xml.
|
# ostree.xml.
|
||||||
man1_files = ostree.1 ostree-admin-cleanup.1 \
|
man1_files = ostree.1 ostree-admin-cleanup.1 \
|
||||||
ostree-admin-config-diff.1 ostree-admin-deploy.1 \
|
ostree-admin-config-diff.1 ostree-admin-deploy.1 \
|
||||||
ostree-admin-init-fs.1 ostree-admin-instutil.1 ostree-admin-os-init.1 \
|
ostree-admin-init-fs.1 ostree-admin-instutil.1 ostree-admin-stateroot-init.1 ostree-admin-os-init.1 \
|
||||||
ostree-admin-status.1 ostree-admin-set-origin.1 ostree-admin-switch.1 \
|
ostree-admin-status.1 ostree-admin-set-origin.1 ostree-admin-switch.1 \
|
||||||
ostree-admin-undeploy.1 ostree-admin-upgrade.1 ostree-admin-unlock.1 \
|
ostree-admin-undeploy.1 ostree-admin-upgrade.1 ostree-admin-unlock.1 \
|
||||||
ostree-admin-pin.1 ostree-admin-set-default.1 \
|
ostree-admin-pin.1 ostree-admin-set-default.1 \
|
||||||
|
@ -65,11 +65,19 @@ License along with this library. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
<title>Options</title>
|
<title>Options</title>
|
||||||
|
|
||||||
<variablelist>
|
<variablelist>
|
||||||
|
<varlistentry>
|
||||||
|
<term><option>--stateroot</option>="STATEROOT"</term>
|
||||||
|
|
||||||
|
<listitem><para>
|
||||||
|
Use a different operating system stateroot than the current one.
|
||||||
|
</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><option>--os</option>="STATEROOT"</term>
|
<term><option>--os</option>="STATEROOT"</term>
|
||||||
|
|
||||||
<listitem><para>
|
<listitem><para>
|
||||||
Use a different operating system root than the current one.
|
Alias for <literal>--stateroot</literal>.
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ License along with this library. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
<refnamediv>
|
<refnamediv>
|
||||||
<refname>ostree-admin-os-init</refname>
|
<refname>ostree-admin-os-init</refname>
|
||||||
<refpurpose>Initialize empty state for a given operating system</refpurpose>
|
<refpurpose>Soft-deprecated alias for stateroot-init</refpurpose>
|
||||||
</refnamediv>
|
</refnamediv>
|
||||||
|
|
||||||
<refsynopsisdiv>
|
<refsynopsisdiv>
|
||||||
@ -57,19 +57,7 @@ License along with this library. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
<title>Description</title>
|
<title>Description</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Initializes an new stateroot (AKA "osname") for an operating system.
|
This is a soft-deprecated alias for stateroot-init. Please see the documentation for that.
|
||||||
Ensures that the core subdirectories of /var (/tmp, /lib, /run, and
|
|
||||||
/lock) exist and initialize the given STATEROOT as OSTree stateroot.
|
|
||||||
Each deployment location is comprised of a single shared
|
|
||||||
<filename>var</filename> and a set of deployments (chroots).
|
|
||||||
</para>
|
</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
<refsect1>
|
|
||||||
<title>Example</title>
|
|
||||||
<para><command>$ ostree admin os-init exampleos</command></para>
|
|
||||||
<programlisting>
|
|
||||||
ostree/deploy/exampleos initialized as OSTree root
|
|
||||||
</programlisting>
|
|
||||||
</refsect1>
|
|
||||||
</refentry>
|
</refentry>
|
||||||
|
75
man/ostree-admin-stateroot-init.xml
Normal file
75
man/ostree-admin-stateroot-init.xml
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
<?xml version='1.0'?> <!--*-nxml-*-->
|
||||||
|
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
|
||||||
|
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Copyright 2014 Anne LoVerso <anne.loverso@students.olin.edu>
|
||||||
|
|
||||||
|
SPDX-License-Identifier: LGPL-2.0+
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<refentry id="ostree">
|
||||||
|
|
||||||
|
<refentryinfo>
|
||||||
|
<title>ostree admin stateroot-init</title>
|
||||||
|
<productname>OSTree</productname>
|
||||||
|
|
||||||
|
<authorgroup>
|
||||||
|
<author>
|
||||||
|
<contrib>Developer</contrib>
|
||||||
|
<firstname>Colin</firstname>
|
||||||
|
<surname>Walters</surname>
|
||||||
|
<email>walters@verbum.org</email>
|
||||||
|
</author>
|
||||||
|
</authorgroup>
|
||||||
|
</refentryinfo>
|
||||||
|
|
||||||
|
<refmeta>
|
||||||
|
<refentrytitle>ostree admin stateroot-init</refentrytitle>
|
||||||
|
<manvolnum>1</manvolnum>
|
||||||
|
</refmeta>
|
||||||
|
|
||||||
|
<refnamediv>
|
||||||
|
<refname>ostree-admin-stateroot-init</refname>
|
||||||
|
<refpurpose>Initialize empty state for a given operating system</refpurpose>
|
||||||
|
</refnamediv>
|
||||||
|
|
||||||
|
<refsynopsisdiv>
|
||||||
|
<cmdsynopsis>
|
||||||
|
<command>ostree admin stateroot-init</command> <arg choice="req">STATEROOT</arg>
|
||||||
|
</cmdsynopsis>
|
||||||
|
</refsynopsisdiv>
|
||||||
|
|
||||||
|
<refsect1>
|
||||||
|
<title>Description</title>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
Initializes an new stateroot (AKA "osname") for an operating system.
|
||||||
|
Ensures that the core subdirectories of /var (/tmp, /lib, /run, and
|
||||||
|
/lock) exist and initialize the given STATEROOT as OSTree stateroot.
|
||||||
|
Each deployment location is comprised of a single shared
|
||||||
|
<filename>var</filename> and a set of deployments (chroots).
|
||||||
|
</para>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1>
|
||||||
|
<title>Example</title>
|
||||||
|
<para><command>$ ostree admin stateroot-init exampleos</command></para>
|
||||||
|
<programlisting>
|
||||||
|
ostree/deploy/exampleos initialized as OSTree stateroot
|
||||||
|
</programlisting>
|
||||||
|
</refsect1>
|
||||||
|
</refentry>
|
@ -51,6 +51,8 @@ static char **opt_overlay_initrds;
|
|||||||
static GOptionEntry options[] = {
|
static GOptionEntry options[] = {
|
||||||
{ "os", 0, 0, G_OPTION_ARG_STRING, &opt_osname,
|
{ "os", 0, 0, G_OPTION_ARG_STRING, &opt_osname,
|
||||||
"Use a different operating system root than the current one", "OSNAME" },
|
"Use a different operating system root than the current one", "OSNAME" },
|
||||||
|
{ "stateroot", 0, 0, G_OPTION_ARG_STRING, &opt_osname, "Target the provided stateroot",
|
||||||
|
"STATEROOT" },
|
||||||
{ "origin-file", 0, 0, G_OPTION_ARG_FILENAME, &opt_origin_path, "Specify origin file",
|
{ "origin-file", 0, 0, G_OPTION_ARG_FILENAME, &opt_origin_path, "Specify origin file",
|
||||||
"FILENAME" },
|
"FILENAME" },
|
||||||
{ "no-prune", 0, 0, G_OPTION_ARG_NONE, &opt_no_prune, "Don't prune the repo when done", NULL },
|
{ "no-prune", 0, 0, G_OPTION_ARG_NONE, &opt_no_prune, "Don't prune the repo when done", NULL },
|
||||||
|
@ -34,7 +34,7 @@ gboolean
|
|||||||
ot_admin_builtin_os_init (int argc, char **argv, OstreeCommandInvocation *invocation,
|
ot_admin_builtin_os_init (int argc, char **argv, OstreeCommandInvocation *invocation,
|
||||||
GCancellable *cancellable, GError **error)
|
GCancellable *cancellable, GError **error)
|
||||||
{
|
{
|
||||||
g_autoptr (GOptionContext) context = g_option_context_new ("OSNAME");
|
g_autoptr (GOptionContext) context = g_option_context_new ("STATEROOT");
|
||||||
|
|
||||||
g_autoptr (OstreeSysroot) sysroot = NULL;
|
g_autoptr (OstreeSysroot) sysroot = NULL;
|
||||||
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
|
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
|
||||||
@ -47,7 +47,7 @@ ot_admin_builtin_os_init (int argc, char **argv, OstreeCommandInvocation *invoca
|
|||||||
|
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
{
|
{
|
||||||
ot_util_usage_error (context, "OSNAME must be specified", error);
|
ot_util_usage_error (context, "STATEROOT must be specified", error);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ ot_admin_builtin_os_init (int argc, char **argv, OstreeCommandInvocation *invoca
|
|||||||
if (!ostree_sysroot_init_osname (sysroot, osname, cancellable, error))
|
if (!ostree_sysroot_init_osname (sysroot, osname, cancellable, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
g_print ("ostree/deploy/%s initialized as OSTree root\n", osname);
|
g_print ("ostree/deploy/%s initialized as OSTree stateroot\n", osname);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,8 @@ static OstreeCommand admin_subcommands[] = {
|
|||||||
"Deprecated commands intended for installer programs" },
|
"Deprecated commands intended for installer programs" },
|
||||||
{ "os-init", OSTREE_BUILTIN_FLAG_NO_REPO, ot_admin_builtin_os_init,
|
{ "os-init", OSTREE_BUILTIN_FLAG_NO_REPO, ot_admin_builtin_os_init,
|
||||||
"Initialize empty state for given operating system" },
|
"Initialize empty state for given operating system" },
|
||||||
|
{ "stateroot-init", OSTREE_BUILTIN_FLAG_NO_REPO, ot_admin_builtin_os_init,
|
||||||
|
"Initialize empty state for given operating system" },
|
||||||
{ "pin", OSTREE_BUILTIN_FLAG_NO_REPO, ot_admin_builtin_pin,
|
{ "pin", OSTREE_BUILTIN_FLAG_NO_REPO, ot_admin_builtin_pin,
|
||||||
"Change the \"pinning\" state of a deployment" },
|
"Change the \"pinning\" state of a deployment" },
|
||||||
{ "set-origin", OSTREE_BUILTIN_FLAG_NO_REPO, ot_admin_builtin_set_origin,
|
{ "set-origin", OSTREE_BUILTIN_FLAG_NO_REPO, ot_admin_builtin_set_origin,
|
||||||
|
@ -97,7 +97,7 @@ assert_file_has_content_literal err.txt "Cannot stage deployment: Not currently
|
|||||||
echo "ok staging does not work when not booted"
|
echo "ok staging does not work when not booted"
|
||||||
|
|
||||||
orig_mtime=$(stat -c '%.Y' sysroot/ostree/deploy)
|
orig_mtime=$(stat -c '%.Y' sysroot/ostree/deploy)
|
||||||
${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmain/x86_64-runtime
|
${CMD_PREFIX} ostree admin deploy --stateroot=testos testos:testos/buildmain/x86_64-runtime
|
||||||
new_mtime=$(stat -c '%.Y' sysroot/ostree/deploy)
|
new_mtime=$(stat -c '%.Y' sysroot/ostree/deploy)
|
||||||
assert_not_streq "${orig_mtime}" "${new_mtime}"
|
assert_not_streq "${orig_mtime}" "${new_mtime}"
|
||||||
# Need a new bootversion, sine we now have two deployments
|
# Need a new bootversion, sine we now have two deployments
|
||||||
|
@ -494,7 +494,7 @@ EOF
|
|||||||
if test -n "${OSTREE_NO_XATTRS:-}"; then
|
if test -n "${OSTREE_NO_XATTRS:-}"; then
|
||||||
echo -e 'disable-xattrs=true\n' >> sysroot/ostree/repo/config
|
echo -e 'disable-xattrs=true\n' >> sysroot/ostree/repo/config
|
||||||
fi
|
fi
|
||||||
${CMD_PREFIX} ostree admin os-init testos
|
${CMD_PREFIX} ostree admin stateroot-init testos
|
||||||
|
|
||||||
case $bootmode in
|
case $bootmode in
|
||||||
"syslinux")
|
"syslinux")
|
||||||
|
Loading…
Reference in New Issue
Block a user