diff --git a/app/xdg-app-builtins-build-export.c b/app/xdg-app-builtins-build-export.c
index a0dc93e3..e3d5243d 100644
--- a/app/xdg-app-builtins-build-export.c
+++ b/app/xdg-app-builtins-build-export.c
@@ -33,10 +33,14 @@
static char *opt_subject;
static char *opt_body;
+static char **opt_key_ids;
+static char *opt_gpg_homedir;
static GOptionEntry options[] = {
{ "subject", 's', 0, G_OPTION_ARG_STRING, &opt_subject, "One line subject", "SUBJECT" },
{ "body", 'b', 0, G_OPTION_ARG_STRING, &opt_body, "Full description", "BODY" },
+ { "gpg-sign", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_key_ids, "GPG Key ID to sign the commit with", "KEY-ID"},
+ { "gpg-homedir", 0, 0, G_OPTION_ARG_STRING, &opt_gpg_homedir, "GPG Homedir to use when looking for keyrings", "HOMEDIR"},
{ NULL }
};
@@ -251,6 +255,24 @@ xdg_app_builtin_build_export (int argc, char **argv, GCancellable *cancellable,
&commit_checksum, cancellable, error))
goto out;
+ if (opt_key_ids)
+ {
+ char **iter;
+
+ for (iter = opt_key_ids; iter && *iter; iter++)
+ {
+ const char *keyid = *iter;
+
+ if (!ostree_repo_sign_commit (repo,
+ commit_checksum,
+ keyid,
+ opt_gpg_homedir,
+ cancellable,
+ error))
+ goto out;
+ }
+ }
+
ostree_repo_transaction_set_ref (repo, NULL, full_branch, commit_checksum);
if (!ostree_repo_commit_transaction (repo, &stats, cancellable, error))
diff --git a/doc/xdg-app-build-export.xml b/doc/xdg-app-build-export.xml
index b53d86a5..eec5d138 100644
--- a/doc/xdg-app-build-export.xml
+++ b/doc/xdg-app-build-export.xml
@@ -102,6 +102,22 @@
+
+
+
+
+ Sign the commit with this GPG key
+
+
+
+
+
+
+
+ GPG Homedir to use when looking for keyrings
+
+
+