cli: enforce argument to upgrade command
authorJo-Philipp Wich <jo@mein.io>
Fri, 10 Feb 2017 08:57:18 +0000 (09:57 +0100)
committerJo-Philipp Wich <jo@mein.io>
Fri, 10 Feb 2017 08:57:22 +0000 (09:57 +0100)
Blindly upgrading all upgradable packages usually brick the system, so disable
support for argument-less upgrade commands for now.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
libopkg/opkg_cmd.c
src/opkg-cl.c

index ce7cf5e..eba833b 100644 (file)
@@ -551,18 +551,6 @@ opkg_upgrade_cmd(int argc, char **argv)
                            err = -1;
                }
          }
-     } else {
-         pkg_vec_t *installed = pkg_vec_alloc();
-
-         pkg_info_preinstall_check();
-
-         pkg_hash_fetch_all_installed(installed);
-         for (i = 0; i < installed->len; i++) {
-              pkg = installed->pkgs[i];
-              if (opkg_upgrade_pkg(pkg))
-                      err = -1;
-         }
-         pkg_vec_free(installed);
      }
 
      if (opkg_configure_packages(NULL))
@@ -1258,7 +1246,7 @@ opkg_print_architecture_cmd(int argc, char **argv)
    array for easier maintenance */
 static opkg_cmd_t cmds[] = {
      {"update", 0, (opkg_cmd_fun_t)opkg_update_cmd, PFM_DESCRIPTION|PFM_SOURCE},
-     {"upgrade", 0, (opkg_cmd_fun_t)opkg_upgrade_cmd, PFM_DESCRIPTION|PFM_SOURCE},
+     {"upgrade", 1, (opkg_cmd_fun_t)opkg_upgrade_cmd, PFM_DESCRIPTION|PFM_SOURCE},
      {"list", 0, (opkg_cmd_fun_t)opkg_list_cmd, PFM_SOURCE},
      {"list_installed", 0, (opkg_cmd_fun_t)opkg_list_installed_cmd, PFM_SOURCE},
      {"list-installed", 0, (opkg_cmd_fun_t)opkg_list_installed_cmd, PFM_SOURCE},
index 1b927e5..c4e4492 100644 (file)
@@ -221,7 +221,7 @@ usage()
 
        printf("\nPackage Manipulation:\n");
        printf("\tupdate                        Update list of available packages\n");
-       printf("\tupgrade                       Upgrade installed packages\n");
+       printf("\tupgrade <pkgs>                Upgrade packages\n");
        printf("\tinstall <pkgs>                Install package(s)\n");
        printf("\tconfigure <pkgs>      Configure unpacked package(s)\n");
        printf("\tremove <pkgs|regexp>  Remove package(s)\n");