tilde.club/deploy.sh

29 lines
814 B
Bash
Raw Normal View History

2024-03-10 04:41:11 -04:00
#!/bin/bash
2024-03-09 02:25:48 -05:00
set -e
echo $SSH_KEY | base64 -d >> /tmp/key
chmod -R 0600 /tmp/key
2024-03-10 04:41:11 -04:00
rsync -e "ssh -i /tmp/key -o StrictHostKeyChecking=no" -avz --delete ./systemd/ $RSYNC_DESTINATION/.config/systemd/user/
2024-03-09 16:36:34 -05:00
cd dist
for item in *; do
2024-03-09 02:25:48 -05:00
echo "copying $item"
if [ -d "$item" ]; then
SOURCE_PATH="$item/"
DEST_PATH="$RSYNC_DESTINATION/$item/"
else
SOURCE_PATH="$item"
DEST_PATH="$RSYNC_DESTINATION"
fi
rsync -e "ssh -i /tmp/key -o StrictHostKeyChecking=no" -avz --delete $SOURCE_PATH $DEST_PATH
done
2024-03-09 16:36:34 -05:00
cd ..
2024-03-09 02:25:48 -05:00
echo "finished copying to remote host..."
2024-03-10 05:00:58 -04:00
ssh -i /tmp/key -o StrictHostKeyChecking=no $(echo "${RSYNC_DESTINATION%%:*}") "systemctl daemon-reload --user ; systemctl stop --user fruitvote ; systemctl start --user fruitvote"
2024-03-10 04:41:11 -04:00
echo "reloading fruitvote..."
2024-03-09 02:25:48 -05:00
rm /tmp/key