summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaoran S. Diao <0@hairydiode.xyz>2019-04-13 22:31:35 -0400
committerHaoran S. Diao <0@hairydiode.xyz>2019-04-13 22:31:35 -0400
commit0559e8bd1055395b032a9c51708c4fea5934715a (patch)
treedebbb2cd1dc8a3026e11b2c406cdbfa550aa519f
parent18a0c695a74081bf73c44921c7af43acf5933885 (diff)
added actual installation
-rw-r--r--Makefile9
-rw-r--r--guardian.c4
2 files changed, 11 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 9dd09ed..509fa91 100644
--- a/Makefile
+++ b/Makefile
@@ -1,2 +1,11 @@
guardian : guardian.c rs232.c
gcc guardian.c rs232.c -o guardian
+install:
+ mkdir /etc/guardian
+ mkdir /etc/guardian/templates
+ cp templates/* /etc/guardian/templates/
+ cp guardian /usr/bin/guardian
+remove:
+ rm -r /etc/guardian/templates/
+ rm -r /etc/guardian
+ rm /usr/bin/guardian
diff --git a/guardian.c b/guardian.c
index 5b5c99d..ba9fdb2 100644
--- a/guardian.c
+++ b/guardian.c
@@ -307,7 +307,7 @@ struct template * * load_templates() {
/*ensures that templates is alteast 1 element big*/
struct template * * templates = (struct template * *)malloc(sizeof(struct template * ));
/*opens templates dir*/
- DIR * templates_dir = opendir("templates");
+ DIR * templates_dir = opendir("/etc/guardian/templates");
if (templates_dir == NULL) {
return NULL;
}
@@ -327,7 +327,7 @@ struct template * * load_templates() {
/* since d_name is just the name of the file and we want
* the full path
*/
- char * fullpath = str_concat("templates/",
+ char * fullpath = str_concat("/etc/guardian/templates/",
entry->d_name);
if (fullpath == NULL) {
return NULL;