2017-02-05 15:42:47 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# My little crappy deploy script
|
|
|
|
# Uploads all files not ignored by git
|
|
|
|
|
2017-02-06 20:20:25 +01:00
|
|
|
TARGET=grzegorz@brzeczyszczykiewicz.pvv.ntnu.no
|
2017-02-05 15:42:47 +01:00
|
|
|
TARGET_PATH='grzegorz'
|
|
|
|
|
|
|
|
array=(); while IFS= read -rd '' item; do array+=("$item"); done < \
|
|
|
|
<(git status -z --short | grep -z ^? | cut -z -d\ -f2-; git ls-files -z)
|
|
|
|
files_not_ignored=("${array[@]}")
|
|
|
|
|
2017-02-06 20:20:25 +01:00
|
|
|
ssh -T "$TARGET" "
|
2018-03-06 23:02:11 +01:00
|
|
|
mv -v '$TARGET_PATH/config.py' /tmp/grzegorz_config.py
|
|
|
|
rm -rfv $TARGET_PATH
|
|
|
|
mkdir -pv $TARGET_PATH
|
|
|
|
mv -v /tmp/grzegorz_config.py '$TARGET_PATH/config.py'
|
2017-02-05 15:42:47 +01:00
|
|
|
"
|
|
|
|
|
2018-03-06 23:02:11 +01:00
|
|
|
echo '== Copying files to target: =='
|
2017-02-05 15:42:47 +01:00
|
|
|
tar -c "${files_not_ignored[@]}" |
|
2017-02-06 20:20:25 +01:00
|
|
|
ssh -T "$TARGET" "
|
2017-02-05 15:42:47 +01:00
|
|
|
tar -vxC $TARGET_PATH
|
|
|
|
"
|
2018-03-06 23:02:11 +01:00
|
|
|
echo '== DONE: =='
|
2017-02-06 20:20:25 +01:00
|
|
|
|
|
|
|
ssh -T "$TARGET" "
|
|
|
|
systemctl --user restart grzegorz@0
|
2017-02-05 15:42:47 +01:00
|
|
|
"
|
2018-02-24 21:30:43 +01:00
|
|
|
|
|
|
|
sleep 1
|
|
|
|
|
|
|
|
ssh -T "$TARGET" "
|
|
|
|
systemctl --user status grzegorz@0
|
|
|
|
"
|