formatting, parameterising, add user safety check

This commit is contained in:
Moritz Münch 2020-06-19 11:44:39 +00:00
parent a077e1346f
commit e2f285b730

31
update
View File

@ -2,19 +2,34 @@
set -e
echo "cloning ..."
web_user="www-data"
user="willipink"
path="/home/willipink/coinmanager"
if [[ "$USER" != "$user" ]]; then
echo "You must be '$user' to run this file."
exit 1
fi
cd $path/coinmanager
echo -n "fetching "
git pull -q origin master >/dev/null
echo "..."
echo "collecting ..."
cd /home/willipink/coinmanager/coinmanager
echo -n "collecting "
pipenv run python manage.py collectstatic --settings coinmanager.production_settings --no-input >/dev/null
echo "..."
echo "bumping ..."
echo -n "bumping "
version=$(date +"%y%m%d")
sed -i "s/[0-9]\{6\}/$version/g" coinc/templates/footer.html
sed -i "s/[0-9]\{6\}/$version/g" coinc/templates/footer.html >/dev/null
echo "..."
echo "owning ..."
sudo chown -R willipink:www-data /home/willipink/coinmanager >/dev/null
echo -n "owning "
sudo chown -R $user:$web_user $path >/dev/null
echo "..."
echo "reloading ..."
echo -n "reloading "
sudo systemctl reload apache2 >/dev/null
echo "..."