Add ostree admin stateroot-init as alias for os-init

To further help deprecate the confusing "osname" terminology.
This commit is contained in:
Colin Walters 2023-08-17 16:46:02 -04:00
parent 9ac938c4ff
commit 9d5ccfefff
6 changed files with 84 additions and 19 deletions

View File

@ -26,7 +26,7 @@ if ENABLE_MAN
# ostree.xml.
man1_files = ostree.1 ostree-admin-cleanup.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-undeploy.1 ostree-admin-upgrade.1 ostree-admin-unlock.1 \
ostree-admin-pin.1 ostree-admin-set-default.1 \

View File

@ -44,7 +44,7 @@ License along with this library. If not, see <https://www.gnu.org/licenses/>.
<refnamediv>
<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>
<refsynopsisdiv>
@ -57,19 +57,7 @@ License along with this library. If not, see <https://www.gnu.org/licenses/>.
<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).
This is a soft-deprecated alias for stateroot-init. Please see the documentation for that.
</para>
</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>

View 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>

View File

@ -34,7 +34,7 @@ gboolean
ot_admin_builtin_os_init (int argc, char **argv, OstreeCommandInvocation *invocation,
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;
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)
{
ot_util_usage_error (context, "OSNAME must be specified", error);
ot_util_usage_error (context, "STATEROOT must be specified", error);
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))
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;
}

View File

@ -47,6 +47,8 @@ static OstreeCommand admin_subcommands[] = {
"Deprecated commands intended for installer programs" },
{ "os-init", OSTREE_BUILTIN_FLAG_NO_REPO, ot_admin_builtin_os_init,
"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,
"Change the \"pinning\" state of a deployment" },
{ "set-origin", OSTREE_BUILTIN_FLAG_NO_REPO, ot_admin_builtin_set_origin,

View File

@ -494,7 +494,7 @@ EOF
if test -n "${OSTREE_NO_XATTRS:-}"; then
echo -e 'disable-xattrs=true\n' >> sysroot/ostree/repo/config
fi
${CMD_PREFIX} ostree admin os-init testos
${CMD_PREFIX} ostree admin stateroot-init testos
case $bootmode in
"syslinux")