1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
/*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
*
* 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, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: Colin Walters <walters@verbum.org>
*/
#include "config.h"
#include <gio/gio.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <locale.h>
#include "ot-main.h"
#include "ot-builtins.h"
static OstreeCommand commands[] = {
/* Note: all admin related commands have
* no_repo as their command flag, but each
* admin command may have their own
* admin flag
*/
{ "admin", OSTREE_BUILTIN_FLAG_NO_REPO,
ostree_builtin_admin,
"Commands for managing a host system booted with ostree" },
{ "cat", OSTREE_BUILTIN_FLAG_NONE,
ostree_builtin_cat,
"Concatenate contents of files"},
{ "checkout", OSTREE_BUILTIN_FLAG_NONE,
ostree_builtin_checkout,
"Check out a commit into a filesystem tree" },
{ "checksum", OSTREE_BUILTIN_FLAG_NO_REPO,
ostree_builtin_checksum,
"Checksum a file or directory" },
{ "commit", OSTREE_BUILTIN_FLAG_NONE,
ostree_builtin_commit,
"Commit a new revision" },
{ "config", OSTREE_BUILTIN_FLAG_NONE,
ostree_builtin_config,
"Change repo configuration settings" },
{ "diff", OSTREE_BUILTIN_FLAG_NONE,
ostree_builtin_diff,
"Compare directory TARGETDIR against revision REV"},
{ "export", OSTREE_BUILTIN_FLAG_NONE,
ostree_builtin_export,
"Stream COMMIT to stdout in tar format" },
{ "find-remotes", OSTREE_BUILTIN_FLAG_NONE,
ostree_builtin_find_remotes,
"Find remotes to serve the given refs" },
{ "create-usb", OSTREE_BUILTIN_FLAG_NONE,
ostree_builtin_create_usb,
"Copy the refs to a USB stick" },
{ "fsck", OSTREE_BUILTIN_FLAG_NONE,
ostree_builtin_fsck,
"Check the repository for consistency" },
#ifndef OSTREE_DISABLE_GPGME
{ "gpg-sign", OSTREE_BUILTIN_FLAG_NONE,
ostree_builtin_gpg_sign,
"Sign a commit" },
#endif /* OSTREE_DISABLE_GPGME */
{ "init", OSTREE_BUILTIN_FLAG_NO_CHECK,
ostree_builtin_init,
"Initialize a new empty repository" },
{ "log", OSTREE_BUILTIN_FLAG_NONE,
ostree_builtin_log,
"Show log starting at commit or ref" },
{ "ls", OSTREE_BUILTIN_FLAG_NONE,
ostree_builtin_ls,
"List file paths" },
{ "prune", OSTREE_BUILTIN_FLAG_NONE,
ostree_builtin_prune,
"Search for unreachable objects" },
{ "pull-local", OSTREE_BUILTIN_FLAG_NONE,
ostree_builtin_pull_local,
"Copy data from SRC_REPO" },
#ifdef HAVE_LIBCURL_OR_LIBSOUP
{ "pull", OSTREE_BUILTIN_FLAG_NONE,
ostree_builtin_pull,
"Download data from remote repository" },
#endif
{ "refs", OSTREE_BUILTIN_FLAG_NONE,
ostree_builtin_refs,
"List refs" },
{ "remote", OSTREE_BUILTIN_FLAG_NO_REPO,
ostree_builtin_remote,
"Remote commands that may involve internet access" },
{ "reset", OSTREE_BUILTIN_FLAG_NONE,
ostree_builtin_reset,
"Reset a REF to a previous COMMIT" },
{ "rev-parse", OSTREE_BUILTIN_FLAG_NONE,
ostree_builtin_rev_parse,
"Output the target of a rev" },
{ "sign", OSTREE_BUILTIN_FLAG_NONE,
ostree_builtin_sign,
"Sign a commit" },
{ "show", OSTREE_BUILTIN_FLAG_NONE,
ostree_builtin_show,
"Output a metadata object" },
{ "static-delta", OSTREE_BUILTIN_FLAG_NONE,
ostree_builtin_static_delta,
"Static delta related commands" },
{ "summary", OSTREE_BUILTIN_FLAG_NONE,
ostree_builtin_summary,
"Manage summary metadata" },
#if defined(HAVE_LIBSOUP) && defined(BUILDOPT_ENABLE_TRIVIAL_HTTPD_CMDLINE)
{ "trivial-httpd", OSTREE_BUILTIN_FLAG_NONE,
ostree_builtin_trivial_httpd,
NULL },
#endif
{ NULL }
};
int
main (int argc,
char **argv)
{
g_autoptr(GError) error = NULL;
int ret;
setlocale (LC_ALL, "");
g_set_prgname (argv[0]);
ret = ostree_run (argc, argv, commands, &error);
if (error != NULL)
{
g_printerr ("%s%serror:%s%s %s\n",
ot_get_red_start (), ot_get_bold_start (),
ot_get_bold_end (), ot_get_red_end (),
error->message);
}
return ret;
}
|