diff --git a/install.sh b/install.sh index 9ed0858..067c39a 100755 --- a/install.sh +++ b/install.sh @@ -1,11 +1,30 @@ #!/bin/bash parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) +echo "" +echo "---" +echo "Creating user rushstats" +echo "---" +if [id rushstats >/dev/null 2>&1]; then + echo "rushstats user already exists, skipping." +else + useradd -s /sbin/nologin rushstats + echo "User rushstats created with /sbin/nologin" +fi + echo "" echo "---" echo "Moving the distributable folder into /srv/gamestats" echo "---" -cp -r "$parent_path"/dist /srv/gamestats +if [ -d /srv/gamestats ]; then + echo "/srv/gamestats already exists; removing" + rm -r /srv/rushstats +fi +mkdir /srv/gamestats +cp -r "$parent_path"/dist /srv/gamestats +cp -r "$parent_path"/loader /srv/gamestats +chown -r /srv/gamestats rushstats rushstats + echo "" echo "---" @@ -31,14 +50,18 @@ echo "[Install]" >> $SYSTEMD_SERVICE_FILE echo "WantedBy=multi-user.target" >> $SYSTEMD_SERVICE_FILE echo "" >> $SYSTEMD_SERVICE_FILE -echo "" -echo "---" -echo "Creating the cron job to refresh the database." -echo "---" +echo "Created new service." +echo cat $SYSTEMD_SERVICE_FILE echo "" echo "---" echo "Reloading daemons and starting service" echo "---" systemctl daeomon-reload -systemctl start rushstats.service \ No newline at end of file +systemctl enable rushstats.service +systemctl start rushstats.service + +echo "" +echo "---" +echo "Creating the cron job to refresh the database." +echo "---" \ No newline at end of file diff --git a/setup.sh b/setup.sh index 1eaf546..c8ca604 100755 --- a/setup.sh +++ b/setup.sh @@ -22,7 +22,7 @@ cp -f ./backend/dist/* ./dist cd "$parent_path"/loader python3 createrushdatabase.py cd ../ -cp -r ./loader/testdb.db ./dist/testdb.db +cp -r ./loader/* ./dist # Move the package into the dist folder and install the needed modules cd "$parent_path"