services-garbaye/podman-gitea/10_install.sh

75 lines
3.5 KiB
Bash
Raw Normal View History

2022-05-26 19:00:27 +00:00
#!/usr/bin/env bash
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
source ${ABSDIR}/../functions.sh
source ${ABSDIR}/vars.sh
ensure_pwd_is_scriptdir
ensure_not_root
ensure_pod_not_exists ${pod_name}
ensure_variables_are_defined "$envvars"
if ! podman volume exists ${dbvolume} ; then
echo "Error : DB volume ${dbvolume} does not exists. Consider running 05_freshinstall.sh if this is the first install."
exit 1
fi
if ! podman volume exists ${datavolume} ; then
echo "Error : DATA volume ${datavolume} does not exists. Consider running 05_freshinstall.sh if this is the first install."
exit 1
fi
cat <<EOT >> .env
APP_NAME=${GARBAYE_GITEA_APPNAME}
GITEA__database__DB_TYPE=postgres
GITEA__database__HOST=db:5432
GITEA__database__NAME=gitea
GITEA__database__PASSWD=${GARBAYE_GITEA_POSTGRES_PASSWORD}
GITEA__database__USER=gitea
GITEA__mailer__ENABLED=true
GITEA__mailer__FROM=${GARBAYE_GITEA_SMTP_FROM}
2022-05-27 11:05:28 +00:00
GITEA__mailer__HOST="${GARBAYE_GITEA_SMTP_SERVER}:25"
2022-05-26 19:00:27 +00:00
GITEA__security__INSTALL_LOCK=true
GITEA__server__DOMAIN=${GARBAYE_GITEA_DOMAIN}
GITEA__server__SSH_DOMAIN=${GARBAYE_GITEA_DOMAIN}
GITEA__server__ROOT_URL="https://${GARBAYE_GITEA_DOMAIN}"
GITEA__server__SSH_PORT=${sshlisten_port}
GITEA__service__DISABLE_REGISTRATION=true
POSTGRES_DB=gitea
POSTGRES_PASSWORD=${GARBAYE_GITEA_POSTGRES_PASSWORD}
POSTGRES_USER=gitea
EOT
export gitea_image
export gitea_version
export postgres_image
export postgres_version
export weblisten_if
export weblisten_port
export sshlisten_if
export sshlisten_port
source ${ABSDIR}/zz_build-images.sh
podman image exists ${gitea_image}:${gitea_version} &&
podman pull ${postgres_image}:${postgres_version} &&
2022-06-09 20:50:46 +00:00
# force refresh of app.ini
podman unshare rm -f `get_podman_volume_path ${datavolume}`/gitea/conf/app.ini
2022-05-26 19:00:27 +00:00
podman-compose --podman-run-args "--env-file .env" up -d &&
echo -n "Waiting for gitea to finish starting " &&
( podman logs -f ${container_name} 2>&1 & ) | grep -q 'NewServer()' &&
echo "OK" &&
2022-06-09 20:36:00 +00:00
podman exec --user 1000:1000 gitea gitea embedded extract --overwrite --destination /data/gitea/ 'templates/home.tmpl'
2022-06-09 20:43:22 +00:00
podman unshare sed -i '/{{.i18n.Tr \"startpage.app_desc\"}}/,${s//SOUSTITRE/;b};$q1' `get_podman_volume_path ${datavolume}`/gitea/templates/home.tmpl &&
2022-06-09 20:36:00 +00:00
podman unshare sed -i '/{{.i18n.Tr \"startpage.install\"}}/,${s//TITRE1/;b};$q1' `get_podman_volume_path ${datavolume}`/gitea/templates/home.tmpl &&
podman unshare sed -i '/{{.i18n.Tr \"startpage.install_desc\" | Str2html}}/,${s//TEXTE1/;b};$q1' `get_podman_volume_path ${datavolume}`/gitea/templates/home.tmpl &&
podman unshare sed -i '/{{.i18n.Tr \"startpage.platform\"}}/,${s//TITRE2/;b};$q1' `get_podman_volume_path ${datavolume}`/gitea/templates/home.tmpl &&
podman unshare sed -i '/{{.i18n.Tr \"startpage.platform_desc\" | Str2html}}/,${s//TEXTE1/;b};$q1' `get_podman_volume_path ${datavolume}`/gitea/templates/home.tmpl &&
podman unshare sed -i '/{{.i18n.Tr \"startpage.lightweight\"}}/,${s//TITRE3/;b};$q1' `get_podman_volume_path ${datavolume}`/gitea/templates/home.tmpl &&
podman unshare sed -i '/{{.i18n.Tr \"startpage.lightweight_desc\" | Str2html}}/,${s//TEXTE3/;b};$q1' `get_podman_volume_path ${datavolume}`/gitea/templates/home.tmpl &&
podman unshare sed -i '/{{.i18n.Tr \"startpage.license\"}}/,${s//TITRE4/;b};$q1' `get_podman_volume_path ${datavolume}`/gitea/templates/home.tmpl &&
podman unshare sed -i '/{{.i18n.Tr \"startpage.license_desc\" | Str2html}}/,${s//TEXTE4/;b};$q1' `get_podman_volume_path ${datavolume}`/gitea/templates/home.tmpl &&
2022-05-26 19:00:27 +00:00
podman pod stop ${pod_name} &&
echo Pod built and stopped. &&
shred -u .env