aboutsummaryrefslogtreecommitdiff
path: root/snag/src/package_db.c
diff options
context:
space:
mode:
authorJack Jamison <jackqjamison@gmail.com>2026-07-23 12:23:40 -0400
committerJack Jamison <jackqjamison@gmail.com>2026-07-23 12:23:40 -0400
commitfa4344e5dedff14af2bce55d29a272495dd6bbb5 (patch)
treeb90719263489365885a704bb4eab155c40c11d71 /snag/src/package_db.c
parente207f7382cf23dcf88700dead255a41c817a0863 (diff)
cache downloads and cleaning
Diffstat (limited to 'snag/src/package_db.c')
-rw-r--r--snag/src/package_db.c43
1 files changed, 0 insertions, 43 deletions
diff --git a/snag/src/package_db.c b/snag/src/package_db.c
index 04705e4..e0d7e8a 100644
--- a/snag/src/package_db.c
+++ b/snag/src/package_db.c
@@ -9,7 +9,6 @@
#include <errno.h>
#define PKG_INFO_CMD "./scripts/get_pkg_attrs.sh"
-#define PKG_INST_CMD "./scripts/run_pkg_install.sh"
// note: fixed location of package database for now
const char pkg_db[] = "./var/snag/packages";
@@ -117,45 +116,3 @@ bool load_package_info(char* pkgid, package_info_t* info) {
return true;
}
-
-void run_package_install(const package_info_t* info) {
-
- // PIPE and FORK to run install script
- int pipefds[2] = {0};
- if (pipe(pipefds) < 0) die("failed to pipe: %s", strerror(errno));
- pid_t pid = fork();
- if (pid < 0) die("failed to fork: %s", strerror(errno));
-
- if (pid == 0) {
- // child proc
- // connect my stdout and stderr to the pipe
- close(pipefds[0]);
- dup2(pipefds[1], STDOUT_FILENO);
- dup2(pipefds[1], STDERR_FILENO);
- close(pipefds[1]);
- // exec into install script
- char* argv[] = { PKG_INST_CMD, info->script_path, NULL };
- char* envp[] = { NULL };
- execve(PKG_INST_CMD, argv, envp);
- // what are you still doing here?
- die("CHILD - execve to %s failed: %s", PKG_INST_CMD, strerror(errno));
- } else {
- // parent proc, close write end of pipe
- close(pipefds[1]);
- }
-
- // read from the pipe until EOF
- char buf[4096];
- ssize_t bytes_read = 0;
- while ((bytes_read = read(pipefds[0], buf, sizeof(buf))) > 0) {
- // print build out, can log and stuff in future
- printf("%.*s", (int)bytes_read, buf);
- }
- if (bytes_read < 0) die("failed to read from pipe: %s", strerror(errno));
- close(pipefds[0]);
-
- // reap the child to finish
- int wstatus;
- if (waitpid(pid, &wstatus, 0) < 0) die("waitpid failed: %s", strerror(errno));
- if (WEXITSTATUS(wstatus) != 0) die("the child failed to execute install script");
-}