mirror of
https://github.com/FUjr/gl-infra-builder.git
synced 2025-12-16 09:10:02 +00:00
61 lines
1.2 KiB
Diff
61 lines
1.2 KiB
Diff
--- a/libopkg/opkg_cmd.c
|
|
+++ b/libopkg/opkg_cmd.c
|
|
@@ -41,6 +41,29 @@
|
|
#include "opkg_configure.h"
|
|
#include "xsystem.h"
|
|
|
|
+int exec_command(const char *command)
|
|
+{
|
|
+ opkg_msg(NOTICE, "Updating database.\n");
|
|
+ remove("/var/lock/opkg.lock");
|
|
+
|
|
+ FILE *fp;
|
|
+
|
|
+ fp = popen(command, "r");
|
|
+ if (fp == NULL) {
|
|
+ return -1;
|
|
+ }
|
|
+ pclose(fp);
|
|
+
|
|
+ fp = fopen("/var/lock/opkg.lock", "w+");
|
|
+ if (fp != NULL) {
|
|
+ fclose(fp);
|
|
+ }
|
|
+
|
|
+ opkg_msg(NOTICE, "Database update completed.\n");
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
static void print_pkg(pkg_t * pkg)
|
|
{
|
|
char *version = pkg_version_str_alloc(pkg);
|
|
@@ -200,7 +224,7 @@ static int opkg_update_cmd(int argc, cha
|
|
rmdir(tmp);
|
|
free(tmp);
|
|
free(lists_dir);
|
|
-
|
|
+ exec_command("update_plugins_db update");
|
|
return failures;
|
|
}
|
|
|
|
@@ -486,7 +510,8 @@ static int opkg_install_cmd(int argc, ch
|
|
err = -1;
|
|
|
|
write_status_files_if_changed();
|
|
-
|
|
+ if (err == 0)
|
|
+ exec_command("update_plugins_db install");
|
|
return err;
|
|
}
|
|
|
|
@@ -914,6 +939,8 @@ static int opkg_remove_cmd(int argc, cha
|
|
opkg_msg(NOTICE, "No packages removed.\n");
|
|
|
|
write_status_files_if_changed();
|
|
+ if (err == 0)
|
|
+ exec_command("update_plugins_db remove");
|
|
return err;
|
|
}
|
|
|