travelynx/update.sh

28 lines
586 B
Bash
Raw Permalink Normal View History

2021-09-12 09:29:39 +00:00
#!/bin/sh
#
# Updates a travelynx instance deployed via git. Performs database migrations
# as necessary.
git pull
if [ "$1" = "with-deps" ]; then
mkdir local.new
cd local.new
cp ../cpanfile* .
carton install
cd ..
sudo systemctl stop travelynx
touch maintenance
2021-09-12 09:29:39 +00:00
mv local local.old
mv local.new/local .
perl index.pl database migrate
rm -f maintenance
2021-09-12 09:29:39 +00:00
sudo systemctl start travelynx
elif perl index.pl database has-current-schema; then
sudo systemctl reload travelynx
else
sudo systemctl stop travelynx
perl index.pl database migrate
sudo systemctl start travelynx
fi