Blame src/ostree/main.c

rpm-build 0fba15
/*
rpm-build 0fba15
 * Copyright (C) 2011 Colin Walters <walters@verbum.org>
rpm-build 0fba15
 *
rpm-build 0fba15
 * SPDX-License-Identifier: LGPL-2.0+
rpm-build 0fba15
 *
rpm-build 0fba15
 * This library is free software; you can redistribute it and/or
rpm-build 0fba15
 * modify it under the terms of the GNU Lesser General Public
rpm-build 0fba15
 * License as published by the Free Software Foundation; either
rpm-build 0fba15
 * version 2 of the License, or (at your option) any later version.
rpm-build 0fba15
 *
rpm-build 0fba15
 * This library is distributed in the hope that it will be useful,
rpm-build 0fba15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
rpm-build 0fba15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
rpm-build 0fba15
 * Lesser General Public License for more details.
rpm-build 0fba15
 *
rpm-build 0fba15
 * You should have received a copy of the GNU Lesser General Public
rpm-build 0fba15
 * License along with this library; if not, write to the
rpm-build 0fba15
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
rpm-build 0fba15
 * Boston, MA 02111-1307, USA.
rpm-build 0fba15
 *
rpm-build 0fba15
 * Author: Colin Walters <walters@verbum.org>
rpm-build 0fba15
 */
rpm-build 0fba15
rpm-build 0fba15
#include "config.h"
rpm-build 0fba15
rpm-build 0fba15
#include <gio/gio.h>
rpm-build 0fba15
rpm-build 0fba15
#include <errno.h>
rpm-build 0fba15
#include <string.h>
rpm-build 0fba15
#include <unistd.h>
rpm-build 0fba15
#include <locale.h>
rpm-build 0fba15
rpm-build 0fba15
#include "ot-main.h"
rpm-build 0fba15
#include "ot-builtins.h"
rpm-build 0fba15
rpm-build 0fba15
static OstreeCommand commands[] = {
rpm-build 0fba15
  /* Note: all admin related commands have
rpm-build 0fba15
   * no_repo as their command flag, but each
rpm-build 0fba15
   * admin command may have their own
rpm-build 0fba15
   * admin flag
rpm-build 0fba15
   */
rpm-build 0fba15
  { "admin", OSTREE_BUILTIN_FLAG_NO_REPO,
rpm-build 0fba15
    ostree_builtin_admin,
rpm-build 0fba15
    "Commands for managing a host system booted with ostree" },
rpm-build 0fba15
  { "cat", OSTREE_BUILTIN_FLAG_NONE,
rpm-build 0fba15
    ostree_builtin_cat,
rpm-build 0fba15
    "Concatenate contents of files"},
rpm-build 0fba15
  { "checkout", OSTREE_BUILTIN_FLAG_NONE,
rpm-build 0fba15
    ostree_builtin_checkout,
rpm-build 0fba15
    "Check out a commit into a filesystem tree" },
rpm-build 0fba15
  { "checksum", OSTREE_BUILTIN_FLAG_NO_REPO,
rpm-build 0fba15
    ostree_builtin_checksum,
rpm-build 0fba15
    "Checksum a file or directory" },
rpm-build 0fba15
  { "commit", OSTREE_BUILTIN_FLAG_NONE,
rpm-build 0fba15
    ostree_builtin_commit,
rpm-build 0fba15
    "Commit a new revision" },
rpm-build 0fba15
  { "config", OSTREE_BUILTIN_FLAG_NONE,
rpm-build 0fba15
    ostree_builtin_config,
rpm-build 0fba15
    "Change repo configuration settings" },
rpm-build 0fba15
  { "diff", OSTREE_BUILTIN_FLAG_NONE,
rpm-build 0fba15
    ostree_builtin_diff,
rpm-build 0fba15
    "Compare directory TARGETDIR against revision REV"},
rpm-build 0fba15
  { "export", OSTREE_BUILTIN_FLAG_NONE,
rpm-build 0fba15
    ostree_builtin_export,
rpm-build 0fba15
    "Stream COMMIT to stdout in tar format" },
rpm-build 0fba15
  { "find-remotes", OSTREE_BUILTIN_FLAG_NONE,
rpm-build 0fba15
    ostree_builtin_find_remotes,
rpm-build 0fba15
    "Find remotes to serve the given refs" },
rpm-build 0fba15
  { "create-usb", OSTREE_BUILTIN_FLAG_NONE,
rpm-build 0fba15
    ostree_builtin_create_usb,
rpm-build 0fba15
    "Copy the refs to a USB stick" },
rpm-build 0fba15
  { "fsck", OSTREE_BUILTIN_FLAG_NONE,
rpm-build 0fba15
    ostree_builtin_fsck,
rpm-build 0fba15
    "Check the repository for consistency" },
rpm-build 0fba15
#ifndef OSTREE_DISABLE_GPGME
rpm-build 0fba15
  { "gpg-sign", OSTREE_BUILTIN_FLAG_NONE,
rpm-build 0fba15
    ostree_builtin_gpg_sign,
rpm-build 0fba15
    "Sign a commit" },
rpm-build 0fba15
#endif /* OSTREE_DISABLE_GPGME */
rpm-build 0fba15
  { "init", OSTREE_BUILTIN_FLAG_NO_CHECK,
rpm-build 0fba15
    ostree_builtin_init,
rpm-build 0fba15
    "Initialize a new empty repository" },
rpm-build 0fba15
  { "log", OSTREE_BUILTIN_FLAG_NONE,
rpm-build 0fba15
    ostree_builtin_log,
rpm-build 0fba15
    "Show log starting at commit or ref" },
rpm-build 0fba15
  { "ls", OSTREE_BUILTIN_FLAG_NONE,
rpm-build 0fba15
    ostree_builtin_ls,
rpm-build 0fba15
    "List file paths" },
rpm-build 0fba15
  { "prune", OSTREE_BUILTIN_FLAG_NONE,
rpm-build 0fba15
    ostree_builtin_prune,
rpm-build 0fba15
    "Search for unreachable objects" },
rpm-build 0fba15
  { "pull-local", OSTREE_BUILTIN_FLAG_NONE,
rpm-build 0fba15
    ostree_builtin_pull_local,
rpm-build 0fba15
    "Copy data from SRC_REPO" },
rpm-build 0fba15
#ifdef HAVE_LIBCURL_OR_LIBSOUP
rpm-build 0fba15
  { "pull", OSTREE_BUILTIN_FLAG_NONE,
rpm-build 0fba15
    ostree_builtin_pull,
rpm-build 0fba15
    "Download data from remote repository" },
rpm-build 0fba15
#endif
rpm-build 0fba15
  { "refs", OSTREE_BUILTIN_FLAG_NONE,
rpm-build 0fba15
    ostree_builtin_refs,
rpm-build 0fba15
    "List refs" },
rpm-build 0fba15
  { "remote", OSTREE_BUILTIN_FLAG_NO_REPO,
rpm-build 0fba15
    ostree_builtin_remote,
rpm-build 0fba15
    "Remote commands that may involve internet access" },
rpm-build 0fba15
  { "reset", OSTREE_BUILTIN_FLAG_NONE,
rpm-build 0fba15
    ostree_builtin_reset,
rpm-build 0fba15
    "Reset a REF to a previous COMMIT" },
rpm-build 0fba15
  { "rev-parse", OSTREE_BUILTIN_FLAG_NONE,
rpm-build 0fba15
    ostree_builtin_rev_parse,
rpm-build 0fba15
    "Output the target of a rev" },
rpm-build 0fba15
  { "sign", OSTREE_BUILTIN_FLAG_NONE,
rpm-build 0fba15
    ostree_builtin_sign,
rpm-build 0fba15
    "Sign a commit" },
rpm-build 0fba15
  { "show", OSTREE_BUILTIN_FLAG_NONE,
rpm-build 0fba15
    ostree_builtin_show,
rpm-build 0fba15
    "Output a metadata object" },
rpm-build 0fba15
  { "static-delta", OSTREE_BUILTIN_FLAG_NONE,
rpm-build 0fba15
    ostree_builtin_static_delta,
rpm-build 0fba15
    "Static delta related commands" },
rpm-build 0fba15
  { "summary", OSTREE_BUILTIN_FLAG_NONE,
rpm-build 0fba15
    ostree_builtin_summary,
rpm-build 0fba15
    "Manage summary metadata" },
rpm-build 0fba15
#if defined(HAVE_LIBSOUP) && defined(BUILDOPT_ENABLE_TRIVIAL_HTTPD_CMDLINE)
rpm-build 0fba15
  { "trivial-httpd", OSTREE_BUILTIN_FLAG_NONE,
rpm-build 0fba15
    ostree_builtin_trivial_httpd,
rpm-build 0fba15
    NULL },
rpm-build 0fba15
#endif
rpm-build 0fba15
  { NULL }
rpm-build 0fba15
};
rpm-build 0fba15
rpm-build 0fba15
int
rpm-build 0fba15
main (int    argc,
rpm-build 0fba15
      char **argv)
rpm-build 0fba15
{
rpm-build 0fba15
  g_autoptr(GError) error = NULL;
rpm-build 0fba15
  int ret;
rpm-build 0fba15
rpm-build 0fba15
  setlocale (LC_ALL, "");
rpm-build 0fba15
rpm-build 0fba15
  g_set_prgname (argv[0]);
rpm-build 0fba15
rpm-build 0fba15
  ret = ostree_run (argc, argv, commands, &error);
rpm-build 0fba15
rpm-build 0fba15
  if (error != NULL)
rpm-build 0fba15
    {
rpm-build 0fba15
      g_printerr ("%s%serror:%s%s %s\n",
rpm-build 0fba15
                  ot_get_red_start (), ot_get_bold_start (),
rpm-build 0fba15
                  ot_get_bold_end (), ot_get_red_end (),
rpm-build 0fba15
                  error->message);
rpm-build 0fba15
    }
rpm-build 0fba15
rpm-build 0fba15
  return ret;
rpm-build 0fba15
}