Build and deploy user-facing frontend (gitea)
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.
 
 
 
 
 
 

23 lines
731 B

  1. #!/bin/bash -ex
  2. HOSTNAME_FQDN=$1
  3. TMP=`mktemp -d /tmp/XXXXXXXXX`
  4. cp -r etc ${TMP}
  5. grep -rl '${HOSTNAME_FQDN}' ${TMP} | xargs sed -i "s/\${HOSTNAME_FQDN}/${HOSTNAME_FQDN}/g"
  6. if [[ ${HOSTNAME_FQDN} == *test.* ]] ; then
  7. BANNER="
  8. <div style='background: red; color: yellow; text-align: center; font-weight: 900;'>
  9. WARNING: THIS IS A TEST INSTANCE. DATA CAN VANISH AT ANY TIME.
  10. </div>"
  11. echo "${BANNER}" > ${TMP}/etc/gitea/templates/custom/body_outer_pre.tmpl
  12. echo "Disallow: /" > ${TMP}/etc/gitea/public/robots.txt
  13. fi
  14. rsync -av -e ssh ${TMP}/etc root@${HOSTNAME_FQDN}:/
  15. rsync -av -e ssh --delete ${TMP}/etc/gitea/public root@${HOSTNAME_FQDN}:/etc/gitea/
  16. ssh root@${HOSTNAME_FQDN} chown -R git.git /etc/gitea
  17. rm -rf ${TMP}