diff --git a/data/bash-completion/fwupdmgr b/data/bash-completion/fwupdmgr index 2e27dadb0..495556a47 100644 --- a/data/bash-completion/fwupdmgr +++ b/data/bash-completion/fwupdmgr @@ -1,5 +1,4 @@ _fwupdmgr_cmd_list=( - 'build-firmware' 'clear-history' 'clear-offline' 'clear-results' @@ -147,23 +146,6 @@ _fwupdmgr() _show_modifiers fi ;; - build-firmware) - #file in - if [[ "$prev" = "$command" ]]; then - _filedir - #file out - elif [[ "$prev" = "${COMP_WORDS[2]}" ]]; then - _filedir - #script - elif [[ "$prev" = "${COMP_WORDS[3]}" ]]; then - _filedir - #output - elif [[ "$prev" = "${COMP_WORDS[4]}" ]]; then - _filedir - else - _show_modifiers - fi - ;; *) #find first command if [[ ${COMP_CWORD} = 1 ]]; then diff --git a/data/bash-completion/fwupdtool.in b/data/bash-completion/fwupdtool.in index 6062e2e50..e5b05ffb3 100644 --- a/data/bash-completion/fwupdtool.in +++ b/data/bash-completion/fwupdtool.in @@ -1,4 +1,5 @@ _fwupdtool_cmd_list=( + 'build-firmware' 'get-details' 'get-devices' 'get-plugins' @@ -66,6 +67,23 @@ _fwupdtool() _show_modifiers fi ;; + build-firmware) + #file in + if [[ "$prev" = "$command" ]]; then + _filedir + #file out + elif [[ "$prev" = "${COMP_WORDS[2]}" ]]; then + _filedir + #script + elif [[ "$prev" = "${COMP_WORDS[3]}" ]]; then + _filedir + #output + elif [[ "$prev" = "${COMP_WORDS[4]}" ]]; then + _filedir + else + _show_modifiers + fi + ;; *) #find first command if [[ ${COMP_CWORD} = 1 ]]; then diff --git a/src/fu-tool.c b/src/fu-tool.c index 858c90311..8a1605971 100644 --- a/src/fu-tool.c +++ b/src/fu-tool.c @@ -906,6 +906,33 @@ fu_util_hwids (FuUtilPrivate *priv, gchar **values, GError **error) return TRUE; } +static gboolean +fu_util_firmware_builder (FuUtilPrivate *priv, gchar **values, GError **error) +{ + const gchar *script_fn = "startup.sh"; + const gchar *output_fn = "firmware.bin"; + g_autoptr(GBytes) archive_blob = NULL; + g_autoptr(GBytes) firmware_blob = NULL; + if (g_strv_length (values) < 2) { + g_set_error_literal (error, + FWUPD_ERROR, + FWUPD_ERROR_INVALID_ARGS, + "Invalid arguments"); + return FALSE; + } + archive_blob = fu_common_get_contents_bytes (values[0], error); + if (archive_blob == NULL) + return FALSE; + if (g_strv_length (values) > 2) + script_fn = values[2]; + if (g_strv_length (values) > 3) + output_fn = values[3]; + firmware_blob = fu_common_firmware_builder (archive_blob, script_fn, output_fn, error); + if (firmware_blob == NULL) + return FALSE; + return fu_common_set_contents_bytes (values[1], firmware_blob, error); +} + int main (int argc, char *argv[]) { @@ -957,6 +984,12 @@ main (int argc, char *argv[]) /* add commands */ priv->cmd_array = g_ptr_array_new_with_free_func ((GDestroyNotify) fu_util_item_free); + fu_util_add (priv->cmd_array, + "build-firmware", + "FILE-IN FILE-OUT [SCRIPT] [OUTPUT]", + /* TRANSLATORS: command description */ + _("Build firmware using a sandbox"), + fu_util_firmware_builder); fu_util_add (priv->cmd_array, "smbios-dump", "FILE", diff --git a/src/fu-util.c b/src/fu-util.c index 147e430b3..6da7b02a4 100644 --- a/src/fu-util.c +++ b/src/fu-util.c @@ -1970,33 +1970,6 @@ fu_util_changed_cb (FwupdClient *client, gpointer user_data) g_print ("%s\n", _("Changed")); } -static gboolean -fu_util_firmware_builder (FuUtilPrivate *priv, gchar **values, GError **error) -{ - const gchar *script_fn = "startup.sh"; - const gchar *output_fn = "firmware.bin"; - g_autoptr(GBytes) archive_blob = NULL; - g_autoptr(GBytes) firmware_blob = NULL; - if (g_strv_length (values) < 2) { - g_set_error_literal (error, - FWUPD_ERROR, - FWUPD_ERROR_INVALID_ARGS, - "Invalid arguments"); - return FALSE; - } - archive_blob = fu_common_get_contents_bytes (values[0], error); - if (archive_blob == NULL) - return FALSE; - if (g_strv_length (values) > 2) - script_fn = values[2]; - if (g_strv_length (values) > 3) - output_fn = values[3]; - firmware_blob = fu_common_firmware_builder (archive_blob, script_fn, output_fn, error); - if (firmware_blob == NULL) - return FALSE; - return fu_common_set_contents_bytes (values[1], firmware_blob, error); -} - static gboolean fu_util_monitor (FuUtilPrivate *priv, gchar **values, GError **error) { @@ -2503,12 +2476,6 @@ main (int argc, char *argv[]) /* TRANSLATORS: command description */ _("Monitor the daemon for events"), fu_util_monitor); - fu_util_add (priv->cmd_array, - "build-firmware", - "FILE-IN FILE-OUT [SCRIPT] [OUTPUT]", - /* TRANSLATORS: command description */ - _("Build firmware using a sandbox"), - fu_util_firmware_builder); fu_util_add (priv->cmd_array, "modify-remote", "REMOTE-ID KEY VALUE",