Add rpm-ostree usroverlay
I saw kalev's slides reference `rpm-ostree unlock`; this patch makes it exist. In general, people have a hard time (understandably) grasping the distinction between ostree and rpm-ostree; along with the goal of making ostree really "libostree", let's start wrapping more commands where it makes sense. I also took this opportunity to have a more descriptive name; it's important to note that it *doesn't* overlay `/etc`, `/var`, or `/boot` for example. Closes: #1233 Approved by: jlebon
This commit is contained in:
parent
d0e322fb69
commit
f26dcd59a2
@ -32,6 +32,7 @@ rpm_ostree_SOURCES = src/app/main.c \
|
||||
src/app/rpmostree-builtin-cleanup.c \
|
||||
src/app/rpmostree-builtin-initramfs.c \
|
||||
src/app/rpmostree-builtin-livefs.c \
|
||||
src/app/rpmostree-builtin-usroverlay.c \
|
||||
src/app/rpmostree-builtin-override.c \
|
||||
src/app/rpmostree-builtin-refresh-md.c \
|
||||
src/app/rpmostree-pkg-builtins.c \
|
||||
|
@ -494,6 +494,33 @@ Boston, MA 02111-1307, USA.
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><command>usroverlay</command></term>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Mount a writable overlay filesystem on <literal>/usr</literal> which
|
||||
is active only for the remainder of the system boot. This is
|
||||
intended for development, testing, and debugging. Changes will not
|
||||
persist across upgrades, or rebooting in general.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
One important goal of this is to support traditional <command>rpm
|
||||
-Uvh /path/to/rpms</command> or equivalent where changes are applied
|
||||
live. However, an intended future feature for
|
||||
<command>rpm-ostree</command> will be a variant of
|
||||
<command>rpm-ostree override</command> which also supports applying
|
||||
changes live, for the cases which one wants persistence as well.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
This command is equivalent to <command>ostree admin unlock</command>.
|
||||
</para>
|
||||
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><command>initramfs</command></term>
|
||||
|
||||
|
@ -65,6 +65,13 @@ static RpmOstreeCommand commands[] = {
|
||||
{ "reload", 0,
|
||||
"Reload configuration",
|
||||
rpmostree_builtin_reload },
|
||||
{ "usroverlay", 0,
|
||||
"Apply a transient overlayfs to /urs",
|
||||
rpmostree_builtin_usroverlay },
|
||||
/* Let's be "cognitively" compatible with `ostree admin unlock` */
|
||||
{ "unlock", RPM_OSTREE_BUILTIN_FLAG_HIDDEN,
|
||||
"",
|
||||
rpmostree_builtin_usroverlay },
|
||||
{ "cancel", 0,
|
||||
"Cancel an active transaction",
|
||||
rpmostree_builtin_cancel },
|
||||
|
61
src/app/rpmostree-builtin-usroverlay.c
Normal file
61
src/app/rpmostree-builtin-usroverlay.c
Normal file
@ -0,0 +1,61 @@
|
||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
|
||||
*
|
||||
* Copyright (C) 2018 Colin Walters <walters@verbum.org>
|
||||
*
|
||||
* This program 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 licence 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, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <glib-unix.h>
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include "rpmostree-builtins.h"
|
||||
#include "rpmostree-libbuiltin.h"
|
||||
|
||||
#include <libglnx.h>
|
||||
|
||||
static GOptionEntry option_entries[] = {
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
gboolean
|
||||
rpmostree_builtin_usroverlay (int argc,
|
||||
char **argv,
|
||||
RpmOstreeCommandInvocation *invocation,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(GOptionContext) context = g_option_context_new ("");
|
||||
glnx_unref_object RPMOSTreeSysroot *sysroot_proxy = NULL;
|
||||
_cleanup_peer_ GPid peer_pid = 0;
|
||||
|
||||
if (!rpmostree_option_context_parse (context,
|
||||
option_entries,
|
||||
&argc, &argv,
|
||||
invocation,
|
||||
cancellable,
|
||||
NULL, NULL,
|
||||
&sysroot_proxy,
|
||||
&peer_pid,
|
||||
NULL,
|
||||
error))
|
||||
return FALSE;
|
||||
|
||||
execlp ("ostree", "ostree", "admin", "unlock", NULL);
|
||||
return glnx_throw_errno_prefix (error, "execvp(ostree admin unlock)");
|
||||
}
|
@ -33,6 +33,7 @@ G_BEGIN_DECLS
|
||||
BUILTINPROTO(compose);
|
||||
BUILTINPROTO(upgrade);
|
||||
BUILTINPROTO(reload);
|
||||
BUILTINPROTO(usroverlay);
|
||||
BUILTINPROTO(deploy);
|
||||
BUILTINPROTO(rebase);
|
||||
BUILTINPROTO(cancel);
|
||||
|
@ -188,3 +188,7 @@ if ! vm_rpmostree install refresh-md-new-pkg --dry-run; then
|
||||
fi
|
||||
vm_stop_httpd vmcheck
|
||||
echo "ok refresh-md"
|
||||
|
||||
vm_rpmostree usroverlay
|
||||
vm_cmd test -w /usr/bin
|
||||
echo "ok usroverlay"
|
||||
|
Loading…
Reference in New Issue
Block a user