Intergrate install/uninstall files into Makefile

This commit is contained in:
Emil 2023-08-12 17:34:37 -06:00
parent fde8555687
commit d7693263ee
No known key found for this signature in database
GPG Key ID: 5432DB986FDBCF8A
5 changed files with 20 additions and 29 deletions

View File

@ -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

View File

@ -1,5 +1,5 @@
#!/bin/sh
DBFILE=probotic_data.sqlite
DBFILE=data.sqlite
rm -f "$DBFILE"
sqlite3 "$DBFILE" -init bootstrap.sql -line '.quit'

View File

@ -1,4 +1,4 @@
#define DBFILE "probotic_data.sqlite"
#define DBFILE "data.sqlite"
/* Disables vulnerable commands */
/* #define NO_VULN_COMMANDS */

View File

@ -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

View File

@ -1,2 +0,0 @@
#!/bin/sh
userdel -rf probotic