From 2dea5bc2ad4281042758f0e9bfe98fa96bc89412 Mon Sep 17 00:00:00 2001 From: dacctal Date: Mon, 25 May 2026 06:39:29 +0000 Subject: declarative package management --- src/update_all.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'src/update_all.c') 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 #include #include #include +#include +#include +#include #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 -- cgit v1.2.3