core: Move rpm-ostree-sign to "rpm-ostree sign"

This commit is contained in:
Colin Walters 2014-03-22 15:12:31 -04:00
parent af49603d6f
commit 05d348528e
4 changed files with 13 additions and 29 deletions

View File

@ -24,15 +24,11 @@ rpm_ostree_SOURCES = src/main.c \
src/rpmostree-postprocess.c \
src/rpmostree-builtins.h \
src/rpmostree-builtin-create.c \
src/rpmostree-builtin-sign.c \
$(NULL)
rpm_ostree_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src -DPKGLIBDIR=\"$(pkglibdir)\" $(PKGDEP_RPMOSTREE_CFLAGS)
rpm_ostree_LDADD = $(AM_LDFLAGS) $(PKGDEP_RPMOSTREE_LIBS)
bin_PROGRAMS += rpm-ostree-sign
rpm_ostree_sign_SOURCES = src/rpm-ostree-sign.c
rpm_ostree_sign_CFLAGS = $(AM_CFLAGS) $(PKGDEP_RPMOSTREE_CFLAGS)
rpm_ostree_sign_LDADD = $(AM_LDFLAGS) $(PKGDEP_RPMOSTREE_LIBS)
privdatadir=$(pkglibdir)
privdata_DATA = src/tmpfiles-ostree-integration.conf

View File

@ -33,6 +33,7 @@
static RpmOstreeCommand commands[] = {
{ "create", rpmostree_builtin_create, 0 },
{ "sign", rpmostree_builtin_sign, 0 },
{ NULL }
};

View File

@ -22,8 +22,8 @@
#include <string.h>
#include <glib-unix.h>
#include <json-glib/json-glib.h>
#include <ostree.h>
#include "rpmostree-builtins.h"
#include "libgsystem.h"
@ -38,13 +38,13 @@ static GOptionEntry option_entries[] = {
{ NULL }
};
int
main (int argc,
char **argv)
gboolean
rpmostree_builtin_sign (int argc,
char **argv,
GCancellable *cancellable,
GError **error)
{
GError *local_error = NULL;
GError **error = &local_error;
GCancellable *cancellable = NULL;
gboolean ret = FALSE;
GOptionContext *context = g_option_context_new ("- Use rpm-sign to sign an OSTree commit");
gs_unref_object GFile *repopath = NULL;
gs_unref_object OstreeRepo *repo = NULL;
@ -132,25 +132,11 @@ main (int argc,
g_print ("Successfully signed OSTree commit=%s with key=%s\n",
checksum, opt_key_id);
ret = TRUE;
out:
if (tmp_commitdata_file)
(void) gs_file_unlink (tmp_commitdata_file, NULL, NULL);
if (tmp_sig_file)
(void) gs_file_unlink (tmp_sig_file, NULL, NULL);
if (local_error != NULL)
{
int is_tty = isatty (1);
const char *prefix = "";
const char *suffix = "";
if (is_tty)
{
prefix = "\x1b[31m\x1b[1m"; /* red, bold */
suffix = "\x1b[22m\x1b[0m"; /* bold off, color reset */
}
g_printerr ("%serror: %s%s\n", prefix, suffix, local_error->message);
g_error_free (local_error);
return 2;
}
else
return 0;
return ret;
}

View File

@ -33,6 +33,7 @@ typedef struct {
#define BUILTINPROTO(name) gboolean rpmostree_builtin_ ## name (int argc, char **argv, GCancellable *cancellable, GError **error)
BUILTINPROTO(create);
BUILTINPROTO(sign);
#undef BUILTINPROTO