Add `ostree admin stateroot-init` as alias for `os-init`
authorColin Walters <walters@verbum.org>
Thu, 17 Aug 2023 20:46:02 +0000 (16:46 -0400)
committerColin Walters <walters@verbum.org>
Thu, 17 Aug 2023 20:46:02 +0000 (16:46 -0400)
To further help deprecate the confusing "osname" terminology.

Makefile-man.am
man/ostree-admin-os-init.xml
man/ostree-admin-stateroot-init.xml [new file with mode: 0644]
src/ostree/ot-admin-builtin-os-init.c
src/ostree/ot-builtin-admin.c
tests/libtest.sh

index 03f16edc0c721aa6313842349b2e962f25540d82..da229bc7cb614f0162b8878d4ea7c325b4faadbb 100644 (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 \
index fbe1ec7432a9191f5f978cd23c60be88bf7db80b..ea141ab81ca3ef135f302055fc1bcca9a836a372 100644 (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>
diff --git a/man/ostree-admin-stateroot-init.xml b/man/ostree-admin-stateroot-init.xml
new file mode 100644 (file)
index 0000000..c9e50ed
--- /dev/null
@@ -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>
index 607bf529ed982ab72f21699c0e59d8b7d62f5dc2..561d6cd442ea4434df99f8709ddd2a72558a3442 100644 (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;
 }
index 14f776c02e8bddeb49a321595114128b347a47cd..0eeb3b2cb1f8a6962f42cbdeb61dbb2ea6364b3e 100644 (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,
index 1956f8036d2e8323743eae2edc08ec91413d174e..9d871aa4304a5d6151e628a7054d3a2f06bdf058 100755 (executable)
@@ -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")