Make this a site-specific install for use post-testing. Require a site name.

This commit is contained in:
Andrew Beals 2020-09-13 00:59:05 +00:00
parent 3264a87c02
commit 172581800e

View File

@ -7,6 +7,14 @@ user=advisorycircular
if test `whoami` != root; then echo you must run this as root ; exit 1 ; fi if test `whoami` != root; then echo you must run this as root ; exit 1 ; fi
site="$1"
if test -z "$site"
then
echo usage: $0 sitename
exit 1
fi
# Create install, config, and run directories if they doesn't exist. # Create install, config, and run directories if they doesn't exist.
echo Creating directories echo Creating directories
mkdir -p "$install_dir" mkdir -p "$install_dir"
@ -37,7 +45,11 @@ cp out/advisorycircular.js "$install_dir"/out
cp config-skel.yaml "$config_dir" cp config-skel.yaml "$config_dir"
cp secrets-skel.yaml "$config_dir" cp secrets-skel.yaml "$config_dir"
cp config.yaml "$config_dir"/"$site"-config.yaml
cp secrets.yaml "$config_dir"/"$site"-secrets.yaml
cp advisorycircular@.service /lib/systemd/system cp advisorycircular@.service /lib/systemd/system
cp advisorycircular@.service /lib/systemd/system/advisorycircular@"$site".service
# Download aircraft info DB. # Download aircraft info DB.
echo Downloading aircraft info database echo Downloading aircraft info database
@ -51,5 +63,10 @@ chown -R "$user" "$install_dir"
chown -R "$user" "$config_dir" chown -R "$user" "$config_dir"
chown -R "$user" "$run_dir" chown -R "$user" "$run_dir"
chmod go-r "$config_dir"/secrets-skel.yaml chmod go-r "$config_dir"/secrets*.yaml
chmod go-w "$run_dir" chmod go-w "$run_dir"
echo "Installation complete."
echo "You probably want to execute the following:"
echo "sudo systemctl enable advisorycircular@${site}.service"
echo "sudo systemctl start advisorycircular@${site}.service"