Move config.py to default_config.py and make deplay.bash not delete config.py on the remote

This commit is contained in:
Peder Bergebakken Sundt 2018-03-06 23:02:11 +01:00
parent 1fc1ab2e1d
commit e7b711b3ad
5 changed files with 14 additions and 5 deletions

2
.gitignore vendored
View File

@ -1,3 +1,3 @@
*.pyc *.pyc
__pycache__ __pycache__
config.ini config.py

View File

@ -24,8 +24,7 @@ When finished, you may run the server with:
python3 main.py python3 main.py
The server should now be available at `http://localhost:8080/`. The server should now be available at `http://localhost:8080/`.
You may change the address and port in the file named `config.py` You may change the address and port in the file named `config.py` which is copied from `default_config.py` when running `main.py` the first time
## Making Grzegorz run on boot ## Making Grzegorz run on boot

View File

@ -10,14 +10,18 @@ array=(); while IFS= read -rd '' item; do array+=("$item"); done < \
files_not_ignored=("${array[@]}") files_not_ignored=("${array[@]}")
ssh -T "$TARGET" " ssh -T "$TARGET" "
rm -rf $TARGET_PATH mv -v '$TARGET_PATH/config.py' /tmp/grzegorz_config.py
mkdir -p $TARGET_PATH rm -rfv $TARGET_PATH
mkdir -pv $TARGET_PATH
mv -v /tmp/grzegorz_config.py '$TARGET_PATH/config.py'
" "
echo '== Copying files to target: =='
tar -c "${files_not_ignored[@]}" | tar -c "${files_not_ignored[@]}" |
ssh -T "$TARGET" " ssh -T "$TARGET" "
tar -vxC $TARGET_PATH tar -vxC $TARGET_PATH
" "
echo '== DONE: =='
ssh -T "$TARGET" " ssh -T "$TARGET" "
systemctl --user restart grzegorz@0 systemctl --user restart grzegorz@0

View File

@ -1,6 +1,12 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import os, shutil
import asyncio import asyncio
import grzegorz import grzegorz
basedir = os.path.dirname(os.path.abspath(__file__))
if not os.path.exists(os.path.join(basedir, "config.py")):
print("copying default_config.py to config.py...")
shutil.copy(os.path.join(basedir, "default_config.py"), os.path.join(basedir, "config.py"))
import config import config
async def grzegorz_splash(): async def grzegorz_splash():