#!/bin/bash
# Build
cd v2
hugo
cd ..
# Backup current deploy
ssh home.hugopoi.net sudo yunohost backup create --apps my_webapp
echo "$1"
if [[ "$1" == "--full" ]]; then
  echo "Deploy full legacy and new blog"
  rsync -rlgoD --checksum --verbose www/ home.hugopoi.net:/var/www/my_webapp/www/
else
  echo "Deploy only the new hugo blog"
  rsync -rlgoD --verbose --checksum --delete www/v2/ home.hugopoi.net:/var/www/my_webapp/www/v2/
fi
