remote-add: Verify that GPG is enabled if collections are

Emit an error message if a collection ID is specified but GPG is not
enabled, since pulling using collection IDs requires GPG.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Philip Withnall
2017-08-11 11:16:00 +01:00
committed by Alexander Larsson
parent 19dbbd5f8c
commit 5c0eef7bde

View File

@@ -330,6 +330,10 @@ flatpak_builtin_add_remote (int argc, char **argv,
if (opt_collection_id != NULL &&
!ostree_validate_collection_id (opt_collection_id, &local_error))
return flatpak_fail (error, _("%s is not a valid collection ID: %s"), opt_collection_id, local_error->message);
if (opt_collection_id != NULL &&
(opt_no_gpg_verify || opt_gpg_import == NULL || opt_gpg_import[0] == NULL))
return flatpak_fail (error, _("GPG verification is required if collections are enabled"));
#endif /* FLATPAK_ENABLE_P2P */
remote_name = argv[1];