diff --git a/Makefile b/Makefile index e0ba189..c147320 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ -# note that this file does not properly handle options - - PROGN:=probotic +USER := probotic +PREFIX = /opt/${USER}/ + CFLAGS:=-std=c99 -Wall -Wextra -Wpedantic -Wvla -Wshadow -Wundef CPPFLAGS:=-I./lib/libircclient/include/ -Iinclude -D_GNU_SOURCE -DPROGN=\"${PROGN}\" -D_FORTIFY_SOURCE=2 @@ -40,4 +40,18 @@ include/config.h: config.mk.h clean: -rm ${OBJ} -.PHONY: clean +${PREFIX}: + mkdir $@ + +bootstrap: + make -C bootstrap + +install: bootstrap ${PREFIX} + useradd ${USER} -r -s /sbin/nologin -d ${PREFIX} || true + install -v -g ${USER} -o ${USER} -m 744 ./bootstrap/data.sqlite ${PROGN} ${PREFIX} + chown ${USER}:${USER} ${PREFIX} -R + +uninstall: + userdel -rf ${USER} + +.PHONY: clean bootstrap install uninstall diff --git a/bootstrap/bootstrap.sh b/bootstrap/bootstrap.sh index 27205c2..1affa30 100755 --- a/bootstrap/bootstrap.sh +++ b/bootstrap/bootstrap.sh @@ -1,5 +1,5 @@ #!/bin/sh -DBFILE=probotic_data.sqlite +DBFILE=data.sqlite rm -f "$DBFILE" sqlite3 "$DBFILE" -init bootstrap.sql -line '.quit' diff --git a/include/config.mk.h b/include/config.mk.h index 0bc82d5..6e718b6 100644 --- a/include/config.mk.h +++ b/include/config.mk.h @@ -1,4 +1,4 @@ -#define DBFILE "probotic_data.sqlite" +#define DBFILE "data.sqlite" /* Disables vulnerable commands */ /* #define NO_VULN_COMMANDS */ diff --git a/install.sh b/install.sh deleted file mode 100755 index d87c966..0000000 --- a/install.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -echo "./uninstall.sh will destroy to whatever TARGET is set to, be careful!" - -# VARIABLES AND PATH -TARGET=${TARGET-/opt/probotic} -DIR=$(dirname $(readlink -f "$0")) -cd $DIR - -# BOOTSTRAP -cd $DIR/bootstrap && ./bootstrap.sh || exit 1 -cd ..; -[ "$BOOTSTRAP_ONLY" = 1 ] && exit 0 - -# INSTALL -mkdir -p $TARGET -useradd probotic -r -s /sbin/nologin -d $TARGET -install -v -g probotic -o probotic -m 744 \ - $DIR/bootstrap/probotic_data.sqlite probotic \ - $TARGET -chown probotic:probotic $TARGET -R diff --git a/uninstall.sh b/uninstall.sh deleted file mode 100755 index abf88f0..0000000 --- a/uninstall.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -userdel -rf probotic