You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

39 lines
886 B

  1. #!/bin/bash
  2. # Copyright (c) 2018 Jan "JayVii" <jayvii@posteo.de>
  3. # SPDX-License-Identifier: GPL-3.0
  4. SOURCEURL="git@localhost:jayvii.de/www.git"
  5. #SERVERUSER="www-data:www-data"
  6. RESTARTCMD="systemctl restart apache2"
  7. WEBROOT="/var/www/html"
  8. if [ -z "$SOURCEURL" ]; then
  9. echo "[ERROR] Source URL not set."
  10. exit 1;
  11. fi
  12. #if [ -z "$SERVERUSER" ]; then
  13. # echo "[ERROR] user not set."
  14. # echo "Set it in the form of:"
  15. # echo "www-data:www-data"
  16. # exit 1;
  17. #fi
  18. if [ -z "$RESTARTCMD" ]; then
  19. echo "[ERROR] restart command not set."
  20. exit 1;
  21. fi
  22. if [ -z "$WEBROOT" ]; then
  23. echo "[ERROR] webroot directory not set."
  24. exit 1;
  25. fi
  26. echo "[INFO] Entering webroot"
  27. cd "$WEBROOT"
  28. echo "[INFO] Pulling updates from $SOURCEURL"
  29. git pull $SOURCEURL
  30. #echo "[INFO] Making readadble/writable by $SERVERUSER"
  31. #chown $SERVERUSER -R ./
  32. echo "[INFO] Restarting Server"
  33. $RESTARTCMD
  34. echo "[INFO] Done."