-static int opkg_install_pending_cmd(opkg_conf_t *conf, int argc, char **argv)
-{
- int i, err;
- char *globpattern;
- glob_t globbuf;
-
- sprintf_alloc(&globpattern, "%s/*" OPKG_PKG_EXTENSION, conf->pending_dir);
- err = glob(globpattern, 0, NULL, &globbuf);
- free(globpattern);
- if (err) {
- return 0;
- }
-
- opkg_message(conf, OPKG_NOTICE,
- "The following packages in %s will now be installed.\n",
- conf->pending_dir);
- for (i = 0; i < globbuf.gl_pathc; i++) {
- opkg_message(conf, OPKG_NOTICE,
- "%s%s", i == 0 ? "" : " ", globbuf.gl_pathv[i]);
- }
- opkg_message(conf, OPKG_NOTICE, "\n");
- for (i = 0; i < globbuf.gl_pathc; i++) {
- err = opkg_install_from_file(conf, globbuf.gl_pathv[i]);
- if (err == 0) {
- err = unlink(globbuf.gl_pathv[i]);
- if (err) {
- opkg_message(conf, OPKG_ERROR,
- "%s: ERROR: failed to unlink %s: %s\n",
- __FUNCTION__, globbuf.gl_pathv[i], strerror(err));
- return err;
- }
- }
- }
- globfree(&globbuf);
-
- return err;
-}
-