From c6316ac5862198803e468b3f9d46fe455b58507b Mon Sep 17 00:00:00 2001 From: Emil Date: Wed, 2 Aug 2023 11:07:35 -0600 Subject: [PATCH] Better installer and fixed bug regarding build --- build.sh | 6 ++++-- install.sh | 9 ++++----- uninstall.sh | 7 +++++++ 3 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 uninstall.sh diff --git a/build.sh b/build.sh index b4c6763..e8fe3a4 100755 --- a/build.sh +++ b/build.sh @@ -14,11 +14,13 @@ LDFLAGS='-lircclient' mkdir -p $PREFIX && echo "Made directory: $PREFIX" -if [ ! -z ${DEBUG} ] ; then CFLAG="$CFLAGS -Og -g3"; - else CFLAG="$CFLAGS -O2 -flto=auto -fomit-frame-pointer"; fi +if [ ! -z ${DEBUG} ]; then CFLAG="$CFLAGS -Og -g3"; + else CFLAG="$CFLAGS -O2 -flto=auto -fomit-frame-pointer -s"; fi [ ! -z ${SAN} ] && CFLAG="$CFLAGS -fsanitize=$SAN" +[ ! -e $DIR/include/config.h ] && cp $DIR/include/config.mk.h $DIR/include/config.h + echo "$CC $CFLAGS -pipe $DIR/src/unity.c -o $PREFIX/$PROGN $CPPFLAGS $LDFLAGS" $CC $CFLAGS -pipe $DIR/src/unity.c -o $PREFIX/$PROGN $CPPFLAGS $LDFLAGS echo "\nStatus: $?" diff --git a/install.sh b/install.sh index 41bf659..543d043 100644 --- a/install.sh +++ b/install.sh @@ -5,11 +5,10 @@ cd $DIR && return # run bootstrapper [ ! -e $DIR/bootstrap/ ] && $DIR/bootstrap/bootstrap.sh -# generate directories and prepare for install +# generate directories and install TARGET=${TARGET-/opt/probotic} +useradd probotic -r -s /sbin/nologin -d $TARGET mkdir -p $TARGET -useradd -r -s /sbin/nologin probotic -d $TARGET -cp $DIR/bootstrap/probotic_data.sqlite $TARGET +install -g probotic -o probotic -m 744 \ + $DIR/bootstrap/probotic_data.sqlite probotic -v $TARGET chown probotic:probotic $TARGET -R -# install files -install -g=probotic -o=probotic -m 744 probotic -sv $TARGET diff --git a/uninstall.sh b/uninstall.sh new file mode 100644 index 0000000..6a1611c --- /dev/null +++ b/uninstall.sh @@ -0,0 +1,7 @@ +#!/bin/sh +# doubles as a cleanup script +DIR=$(dirname $(readlink -f "$0")) +cd $DIR +TARGET=${TARGET-/opt/probotic} +userdel probotic +rm -rf $TARGET $DIR/bootstrap/probotic_data.sqlite probotic