From 057fbcb4590de17acdb81f3201e38085e3d3f325 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Tue, 13 Dec 2016 11:13:33 +0100 Subject: [PATCH] install: Make --from and --bundle optional If the first argument has the right extension we just assume you want to install from it. This fixes https://github.com/flatpak/flatpak/issues/429 and https://github.com/flatpak/flatpak/issues/415 --- app/flatpak-builtins-install.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/flatpak-builtins-install.c b/app/flatpak-builtins-install.c index d05b3adf..2885c7e0 100644 --- a/app/flatpak-builtins-install.c +++ b/app/flatpak-builtins-install.c @@ -130,6 +130,8 @@ install_bundle (FlatpakDir *dir, file = g_file_new_for_commandline_arg (filename); + if (!g_file_is_native (file)) + return flatpak_fail (error, _("Remote bundles are not supported")); if (opt_gpg_file != NULL) { @@ -370,6 +372,14 @@ flatpak_builtin_install (int argc, char **argv, GCancellable *cancellable, GErro if (!flatpak_option_context_parse (context, options, &argc, &argv, 0, &dir, cancellable, error)) return FALSE; + if (!opt_bundle && !opt_from && !opt_oci && argc >= 2) + { + if (g_str_has_suffix (argv[1], ".flatpakref")) + opt_from = TRUE; + if (g_str_has_suffix (argv[1], ".flatpak")) + opt_bundle = TRUE; + } + if (opt_bundle) return install_bundle (dir, context, argc, argv, cancellable, error);