5 printf("\nPackage Manipulation:\n");
6 printf("\tupdate Update list of available packages\n");
7 - printf("\tupgrade Upgrade all installed packages to latest version\n");
8 printf("\tinstall <pkg> Download and install <pkg> (and dependencies)\n");
9 printf("\tinstall <file.opk> Install package <file.opk>\n");
10 printf("\tconfigure [<pkg>] Configure unpacked packages\n");
12 printf("\nInformational Commands:\n");
13 printf("\tlist List available packages and descriptions\n");
14 printf("\tlist_installed List all and only the installed packages and description \n");
15 - printf("\tlist_upgradable List all the installed and upgradable packages\n");
16 printf("\tfiles <pkg> List all files belonging to <pkg>\n");
17 printf("\tsearch <file|regexp> Search for a package providing <file>\n");
18 printf("\tinfo [pkg|regexp] Display all info for <pkg>\n");
19 --- a/libopkg/opkg_cmd.c
20 +++ b/libopkg/opkg_cmd.c
22 static void *p_userdata = NULL;
24 static int opkg_update_cmd(opkg_conf_t *conf, int argc, char **argv);
25 -static int opkg_upgrade_cmd(opkg_conf_t *conf, int argc, char **argv);
26 static int opkg_list_cmd(opkg_conf_t *conf, int argc, char **argv);
27 static int opkg_info_cmd(opkg_conf_t *conf, int argc, char **argv);
28 static int opkg_status_cmd(opkg_conf_t *conf, int argc, char **argv);
29 static int opkg_install_pending_cmd(opkg_conf_t *conf, int argc, char **argv);
30 static int opkg_install_cmd(opkg_conf_t *conf, int argc, char **argv);
31 static int opkg_list_installed_cmd(opkg_conf_t *conf, int argc, char **argv);
32 -static int opkg_list_upgradable_cmd(opkg_conf_t *conf, int argc, char **argv);
33 static int opkg_remove_cmd(opkg_conf_t *conf, int argc, char **argv);
34 static int opkg_purge_cmd(opkg_conf_t *conf, int argc, char **argv);
35 static int opkg_flag_cmd(opkg_conf_t *conf, int argc, char **argv);
37 array for easier maintenance */
38 static opkg_cmd_t cmds[] = {
39 {"update", 0, (opkg_cmd_fun_t)opkg_update_cmd},
40 - {"upgrade", 0, (opkg_cmd_fun_t)opkg_upgrade_cmd},
41 {"list", 0, (opkg_cmd_fun_t)opkg_list_cmd},
42 {"list_installed", 0, (opkg_cmd_fun_t)opkg_list_installed_cmd},
43 - {"list_upgradable", 0, (opkg_cmd_fun_t)opkg_list_upgradable_cmd},
44 {"info", 0, (opkg_cmd_fun_t)opkg_info_cmd},
45 {"flag", 1, (opkg_cmd_fun_t)opkg_flag_cmd},
46 {"status", 0, (opkg_cmd_fun_t)opkg_status_cmd},
51 -static int opkg_upgrade_cmd(opkg_conf_t *conf, int argc, char **argv)
58 - signal(SIGINT, sigint_handler);
61 - for (i=0; i < argc; i++) {
62 - char *arg = argv[i];
64 - err = opkg_prepare_url_for_install(conf, arg, &arg);
65 - if (err != EINVAL && err != 0)
68 - pkg_info_preinstall_check(conf);
70 - for (i=0; i < argc; i++) {
71 - char *arg = argv[i];
72 - if (conf->restrict_to_default_dest) {
73 - pkg = pkg_hash_fetch_installed_by_name_dest(&conf->pkg_hash,
75 - conf->default_dest);
77 - opkg_message(conf, OPKG_NOTICE,
78 - "Package %s not installed in %s\n",
79 - argv[i], conf->default_dest->name);
83 - pkg = pkg_hash_fetch_installed_by_name(&conf->pkg_hash,
87 - opkg_upgrade_pkg(conf, pkg);
89 - opkg_install_by_name(conf, arg);
93 - pkg_vec_t *installed = pkg_vec_alloc();
95 - pkg_info_preinstall_check(conf);
97 - pkg_hash_fetch_all_installed(&conf->pkg_hash, installed);
98 - for (i = 0; i < installed->len; i++) {
99 - pkg = installed->pkgs[i];
100 - opkg_upgrade_pkg(conf, pkg);
102 - pkg_vec_free(installed);
105 - /* recheck to verify that all dependences are satisfied */
106 - if (0) opkg_satisfy_all_dependences(conf);
108 - opkg_configure_packages(conf, NULL);
110 - write_status_files_if_changed(conf);
115 static int opkg_download_cmd(opkg_conf_t *conf, int argc, char **argv)
121 -static int opkg_list_upgradable_cmd(opkg_conf_t *conf, int argc, char **argv)
123 - struct active_list *head = prepare_upgrade_list(conf);
124 - struct active_list *node=NULL;
125 - pkg_t *_old_pkg, *_new_pkg;
126 - char *old_v, *new_v;
127 - for (node = active_list_next(head, head); node;node = active_list_next(head,node)) {
128 - _old_pkg = list_entry(node, pkg_t, list);
129 - _new_pkg = pkg_hash_fetch_best_installation_candidate_by_name(conf, _old_pkg->name, NULL);
130 - old_v = pkg_version_str_alloc(_old_pkg);
131 - new_v = pkg_version_str_alloc(_new_pkg);
133 - opkg_cb_list(_old_pkg->name, new_v, old_v, _old_pkg->state_status, p_userdata);
137 - active_list_head_delete(head);
141 static int opkg_info_status_cmd(opkg_conf_t *conf, int argc, char **argv, int installed_only)