From 53a3d9a778029d4814e4a5c1fcf4b6d035373788 Mon Sep 17 00:00:00 2001 From: asandikci Date: Thu, 27 Jul 2023 12:22:51 +0300 Subject: [PATCH] temporary install --- README.md | 2 +- c-daemon/daemon/daemon.c | 2 +- c-daemon/tmp-install.sh | 23 +++++++++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 c-daemon/tmp-install.sh diff --git a/README.md b/README.md index 405a55a..bec322f 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ This repo will be include two separate daemons. One of them is written with C la
### C-Daemon +look c-daemon/tmp-install.sh for installing as daemon! (temporary) Dependencies `git, go, gcc` @@ -34,7 +35,6 @@ cd c-daemon/bin/ ``` -
--- diff --git a/c-daemon/daemon/daemon.c b/c-daemon/daemon/daemon.c index 07b4f9f..57f5fff 100644 --- a/c-daemon/daemon/daemon.c +++ b/c-daemon/daemon/daemon.c @@ -48,7 +48,7 @@ int _daemon(int nochdir, int noclose){ dup(0); } while (1) { - int status = system("./info"); + int status = system("/usr/lib/cdaemontmp/info"); // TODO SECURITY ISSUE // LINK https://stackoverflow.com/questions/5237482/how-do-i-execute-an-external-program-within-c-code-in-linux-with-arguments# diff --git a/c-daemon/tmp-install.sh b/c-daemon/tmp-install.sh new file mode 100644 index 0000000..22b9e90 --- /dev/null +++ b/c-daemon/tmp-install.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# Temporary Install file for testing until binary installation packages are ready + + +### C-daemon +# Cleaning +sudo rm /usr/bin/cdaemontmp +sudo rm -rf /usr/lib/cdaemontmp/ + +# Building +git clone https://git.aliberksandikci.com.tr/liderahenk/go-daemon +cd go-daemon/ +go build -o c-daemon/bin/ c-daemon/go-files/info.go +gcc -o c-daemon/bin/test c-daemon/daemon/test.c c-daemon/daemon/daemon.c +sudo ln -sv "$(pwd)"/c-daemon/bin/info /info +``` + +# Installing +# move to +cd c-daemon +sudo mv bin/test /usr/bin/cdaemontmp +sudo mv bin/info /usr/lib/cdaemontmp/info \ No newline at end of file