855d1293ab
We've had many bugs from internal helpers using `return EXIT_FAILURE` rather than `return FALSE`. The reason we need exit codes is to handle the `RPM_OSTREE_EXIT_UNCHANGED` case. I realized recently that we had the handy `RpmOstreeCommandInvocation` which we can use to signal back this special case. Then all of our functions otherwise are just normal `GError`. One minor wart here is the two cases of "usage error" versus "command invocation" in `main.c`, but IMO the general cleanup is well worth that. Closes: #1169 Approved by: jlebon
46 lines
1.8 KiB
C
46 lines
1.8 KiB
C
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
|
|
*
|
|
* Copyright (C) 2016 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 "rpmostree-container-builtins.h"
|
|
#include "rpmostree-rpm-util.h"
|
|
|
|
static RpmOstreeCommand container_subcommands[] = {
|
|
{ "init", RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD,
|
|
"Initialize a local container", rpmostree_container_builtin_init },
|
|
{ "assemble", RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD,
|
|
"Assemble a local container", rpmostree_container_builtin_assemble },
|
|
/* { "start", rpmostree_container_builtin_start }, */
|
|
{ "upgrade", RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD,
|
|
"Perform a local container upgrade", rpmostree_container_builtin_upgrade },
|
|
{ NULL, 0, NULL, NULL }
|
|
};
|
|
|
|
gboolean
|
|
rpmostree_builtin_container (int argc, char **argv,
|
|
RpmOstreeCommandInvocation *invocation,
|
|
GCancellable *cancellable, GError **error)
|
|
{
|
|
return rpmostree_handle_subcommand (argc, argv, container_subcommands,
|
|
invocation, cancellable, error);
|
|
}
|
|
|