blob: be2b170fd905b47fe533bd7e811e64508893f44e [file] [log] [blame]
Philipp Schrader0f5d2502022-03-08 22:44:55 -08001#!/bin/bash
2
3# This script runs after the frc971-scouting-server package is installed. This
4# script is responsible for making sure the webserver has everything it needs,
5# then starts the webserver.
6
7set -o errexit
8set -o nounset
9set -o pipefail
10
11# Create a directory for the database to live in.
12mkdir -p /var/frc971/scouting/
13
14# Create an empty The Blue Alliance configuration file.
15if [[ ! -e /var/frc971/scouting/tba_config.json ]]; then
16 echo '{}' > /var/frc971/scouting/tba_config.json
17fi
18
19# Make sure it's all usable by the user.
20chown -R www-data:www-data /var/frc971/scouting/
21
Philipp Schraderc62aeb82022-03-18 22:02:21 -070022# Update the timestamps on the files so that web browsers pull the new version.
23# Otherwise users have to explicitly bypass the cache when visiting the site.
24find /opt/frc971/scouting_server/scouting/www/ -type f -exec touch {} +
25
Philipp Schrader0f5d2502022-03-08 22:44:55 -080026systemctl daemon-reload
27systemctl enable scouting.service
28systemctl start scouting.service || :