+struct alternative_provider {
+ char *name;
+ char *altpath;
+};
+
+static const struct alternative_provider const providers[] = {
+ {
+ .name = "busybox",
+ .altpath = "/bin/busybox",
+ },
+};
+
+static const char *pkg_alternatives_check_providers(const char *path)
+{
+ pkg_t *pkg;
+ str_list_t *files;
+ str_list_elt_t *iter;
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(providers); i++) {
+ pkg = pkg_hash_fetch_installed_by_name(providers[i].name);
+ if (!pkg) {
+ continue;
+ }
+ files = pkg_get_installed_files(pkg);
+ for (iter = str_list_first(files); iter; iter = str_list_next(files, iter)) {
+ if (!strcmp(path, (char *)(iter->data))) {
+ pkg_free_installed_files(pkg);
+ return providers[i].altpath;
+ }
+ }
+ pkg_free_installed_files(pkg);
+ }
+ return NULL;
+}
+