6 progress_callback (opkg_t
*opkg
, const opkg_progress_data_t
*progress
, void *data
)
8 printf ("\r%s %3d%%", (char*) data
, progress
->percentage
);
13 package_list_callback (opkg_t
*opkg
, opkg_package_t
*pkg
, void *data
)
15 static install_count
= 0;
16 static total_count
= 0;
23 printf ("\rPackage count: %d Installed, %d Total Available", install_count
, total_count
);
26 opkg_package_free (pkg
);
30 package_list_upgradable_callback (opkg_t
*opkg
, opkg_package_t
*pkg
, void *data
)
32 printf ("%s - %s\n", pkg
->name
, pkg
->version
);
36 main (int argc
, char **argv
)
43 opkg_set_option (opkg
, "offline_root", "/tmp/");
45 opkg_re_read_config_files (opkg
);
47 err
= opkg_update_package_lists (opkg
, progress_callback
, "Updating...");
48 printf ("\nopkg_update_package_lists returned %d\n", err
);
50 err
= opkg_install_package (opkg
, "aspell", progress_callback
, "Installing...");
51 printf ("\nopkg_install_package returned %d\n", err
);
53 err
= opkg_upgrade_package (opkg
, "aspell", progress_callback
, "Upgrading...");
54 printf ("\nopkg_upgrade_package returned %d\n", err
);
56 err
= opkg_remove_package (opkg
, "aspell", progress_callback
, "Removing...");
57 printf ("\nopkg_remove_package returned %d\n", err
);
59 printf ("Listing upgradable packages...\n");
60 opkg_list_upgradable_packages (opkg
, package_list_upgradable_callback
, NULL
);
62 err
= opkg_upgrade_all (opkg
, progress_callback
, "Upgrading all...");
63 printf ("\nopkg_upgrade_all returned %d\n", err
);
65 opkg_list_packages (opkg
, package_list_callback
, NULL
);