From 8ce19f85df582c6063a82cb87ff27d49514ff98f Mon Sep 17 00:00:00 2001 From: Amy Parker Date: Thu, 3 Aug 2023 11:50:43 -0700 Subject: [PATCH] installer: enable `make install` This patch enables `make install` to allow for installing into a new directory. Signed-off-by: Amy Parker --- Makefile | 8 +++++++- install.sh | 16 +++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 3d2456d..23f3ffb 100644 --- a/Makefile +++ b/Makefile @@ -23,6 +23,7 @@ SASS := sass SASS_OPTIONS := SASS_SRCS = $(shell find scss/ -name '*.scss') +INSTALLDIR := # TODO: automatically compile sass instead of manual @@ -32,4 +33,9 @@ all: $(MAKE) -C js ssvplwc: - cd srv/ssvplwc; cargo run --release \ No newline at end of file + cd srv/ssvplwc; cargo run --release + +install: + mkdir -p $(INSTALLDIR) + cp -a . $(INSTALLDIR) + chown -R $(USER):$(USER) $(INSTALLDIR) \ No newline at end of file diff --git a/install.sh b/install.sh index 930d206..0c5f187 100755 --- a/install.sh +++ b/install.sh @@ -103,8 +103,22 @@ if [ "$INISCS" != "n" ]; then python3 srv/initialized_cached_stats.py fi +echo -n "Would you like to run the full installation now? n/[y] " +read CONTINS +if [ "$CONTINS" == "n" ]; then + echo "Existing SSVP installation wizard. Remember to set up cron jobs." + exit 0 +fi + +echo -n "Installation directory [current directory]: " +read INSDIR +if [ "$INSDIR" == "" ]; then + INSDIR=$(pwd) +fi + +$PREROOT make install INSTALLDIR=$INSDIR + echo "Installation finished. Remember to set up a cron job for srv/interval.py to run every 5 minutes (this will be automated in the future)" # next todo: cron (also implement systemd timers) -# next todo: get install directory (default: /opt/ssvp), `make install` # next todo: systemd service for web server? \ No newline at end of file