aboutsummaryrefslogtreecommitdiff
path: root/src/update_all.c
diff options
context:
space:
mode:
authordacctal <dacctal@symlinx.net>2026-05-25 06:39:29 +0000
committerdacctal <dacctal@symlinx.net>2026-05-25 06:39:29 +0000
commit2dea5bc2ad4281042758f0e9bfe98fa96bc89412 (patch)
tree325a53d3e82459b91a03e167fc8d32bc1c9f90ec /src/update_all.c
parentcb7e87a7889c8ee3f33db43dc2f5653385dc9e29 (diff)
declarative package management
Diffstat (limited to 'src/update_all.c')
-rw-r--r--src/update_all.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/update_all.c b/src/update_all.c
index 1018f65..ff0f54d 100644
--- a/src/update_all.c
+++ b/src/update_all.c
@@ -1,17 +1,34 @@
+#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
#include "update_all.h"
+#include "files.h"
#include "create_pkg.h"
#include "update_pkg.h"
#include "lua_state.h"
+#include "set_install_directories.h"
+#include "vars.h"
void update_all() {
- init_lua_state();
- cache_repos();
- for (size_t i = 0; i < cached_repos_count; i++) {
- Pkg pkg = create_pkg(cached_repos[i].source_value, "default");
- update_pkg(pkg);
- }
+ init_lua_state();
+ cache_repos();
+ struct dirent* dirent_ptr;
+ DIR* dir_ptr;
+ if ((dir_ptr = opendir(src)) == NULL) {
+ fprintf(stderr, "%scould not open %s\n", print_pkgit, src);
+ }
+ while ((dirent_ptr = readdir(dir_ptr)) != NULL) {
+ if (strcmp(dirent_ptr->d_name, "..") == 0 || strcmp(dirent_ptr->d_name, ".") == 0) continue;
+ struct stat stat_buf;
+ FILE* file_ptr = fopen(dirent_ptr->d_name, "r");
+ if (!file_ptr) { continue; }
+ Pkg pkg = create_pkg(dirent_ptr->d_name, "default");
+ update_pkg(pkg);
+ }
+ closedir(dir_ptr);
} \ No newline at end of file