Browse Source

Intergrate install/uninstall files into Makefile

master
Emil 9 months ago
parent
commit
d7693263ee
No known key found for this signature in database GPG Key ID: 5432DB986FDBCF8A
5 changed files with 20 additions and 29 deletions
  1. +18
    -4
      Makefile
  2. +1
    -1
      bootstrap/bootstrap.sh
  3. +1
    -1
      include/config.mk.h
  4. +0
    -21
      install.sh
  5. +0
    -2
      uninstall.sh

+ 18
- 4
Makefile 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

+ 1
- 1
bootstrap/bootstrap.sh 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'

+ 1
- 1
include/config.mk.h View File

@@ -1,4 +1,4 @@
#define DBFILE "probotic_data.sqlite"
#define DBFILE "data.sqlite"

/* Disables vulnerable commands */
/* #define NO_VULN_COMMANDS */


+ 0
- 21
install.sh 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

+ 0
- 2
uninstall.sh View File

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