2020-02-08 00:36:50 +01:00
|
|
|
#!/bin/bash
|
2020-02-12 10:26:59 +01:00
|
|
|
echo "Deployment script for repository \"web-deployment\"
|
|
|
|
`date`
|
|
|
|
=============================================================================="
|
2020-02-12 05:49:44 +01:00
|
|
|
|
2020-03-12 22:21:48 +01:00
|
|
|
#activate ** globs
|
|
|
|
if [ -n "`shopt globstar | grep off`" ]; then shopt -s globstar; fi
|
|
|
|
#remove READMEs
|
|
|
|
rm ./threadr/**/README.md
|
|
|
|
|
2020-03-10 21:28:12 +01:00
|
|
|
#run the code variable replacement
|
2020-03-13 22:57:18 +01:00
|
|
|
echo -n "`find -name "*.php" -or -name "*.html" -or -name "*.css" | sed 's/^/python variable_grabbler.py /;s/$/ variable_grabbler.pass0.json/'`" | bash -
|
|
|
|
echo -n "`find -name "*.php" -or -name "*.html" -or -name "*.css" | sed 's/^/python variable_grabbler.py /;s/$/ variable_grabbler.pass1.json/'`" | bash -
|
|
|
|
echo -n "`find -name "*.php" -or -name "*.html" -or -name "*.css" | sed 's/^/python variable_grabbler.py /;s/$/ variable_grabbler.pass2.json/'`" | bash -
|
2020-02-19 03:54:48 +01:00
|
|
|
|
2020-03-10 21:28:12 +01:00
|
|
|
#the run-once section
|
2020-02-26 11:09:40 +01:00
|
|
|
echo "Checking run-once script..."
|
|
|
|
echo "Setting permissions."
|
|
|
|
chmod +x run-once-script.sh
|
2020-03-10 21:28:12 +01:00
|
|
|
#run the script only if it has changed since the last time it was checked, save a checksum of it to /var/www/git/run-once to compare next time
|
2020-02-26 11:09:40 +01:00
|
|
|
echo -ne "import os, sys\nif \"`sha256sum run-once-script.sh`\" == \"`cat ../run-once`\":\n print \"File has not changed. Aborting.\"\n sys.exit()\nelse:\n print \"File has changed. Calculating checksum...\"\n os.system(\"sha256sum run-once-script.sh > ../run-once\")\n print \"\"\"Executing...\n==========\"\"\"\n os.system(\"./run-once-script.sh\")\n print \"\"\"==========\nDone.\"\"\"" | python
|
|
|
|
|
2020-03-10 21:28:12 +01:00
|
|
|
# The status page is not just symlinked like the other files just to have a backup in case something goes wrong.
|
|
|
|
# Not like that ever happened before....
|
2020-03-08 18:07:50 +01:00
|
|
|
echo "Replacing status page..."
|
|
|
|
cp -v ./strassenkind.php /var/www/strassenkind.ip/index.php
|
|
|
|
cp -v ./internal.css /var/www/strassenkind.ip/style.css
|
2020-03-08 18:10:42 +01:00
|
|
|
cp -v ./commands_git.conf /var/www/strassenkind.ip/
|
|
|
|
cp -v ./commands_ondemand.conf /var/www/strassenkind.ip/
|
|
|
|
cp -v ./commands_status.conf /var/www/strassenkind.ip/
|
2020-03-08 18:14:55 +01:00
|
|
|
echo "Done."
|
2020-02-26 11:09:40 +01:00
|
|
|
|
2020-03-12 22:21:48 +01:00
|
|
|
|
2020-02-12 10:26:59 +01:00
|
|
|
echo "==============================================================================
|
|
|
|
Done."
|