mirror of
https://github.com/multipleof4/git.planetrenox.com.git
synced 2026-01-14 08:27:56 +00:00
Create init.sh
This commit is contained in:
35
init.sh
Normal file
35
init.sh
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
set -eu
|
||||||
|
mkdir -p /data/gitea/conf /data/gitea/custom /data/custom /data/caddy
|
||||||
|
|
||||||
|
# Bootstrap Gitea
|
||||||
|
if [ ! -f /data/.bootstrapped ]; then
|
||||||
|
/usr/local/bin/gitea migrate
|
||||||
|
/usr/local/bin/gitea admin user create --admin \
|
||||||
|
--username "${GITEA_ADMIN_USER}" \
|
||||||
|
--password "${GITEA_ADMIN_PASSWD}" \
|
||||||
|
--email "${GITEA_ADMIN_EMAIL}" || true
|
||||||
|
touch /data/.bootstrapped
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Pull Gitea customizations
|
||||||
|
if [ -n "${CUSTOM_REPO_URL:-}" ]; then
|
||||||
|
if [ ! -d /data/custom/.git ]; then
|
||||||
|
git clone --depth 1 "${CUSTOM_REPO_URL}" /data/custom || true
|
||||||
|
else
|
||||||
|
git -C /data/custom pull --ff-only || true
|
||||||
|
fi
|
||||||
|
rsync -a --delete /data/custom/ /data/gitea/custom/
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Pull Caddy config
|
||||||
|
if [ -n "${CADDY_REPO_URL:-}" ]; then
|
||||||
|
if [ ! -d /data/caddyrepo/.git ]; then
|
||||||
|
git clone --depth 1 "${CADDY_REPO_URL}" /data/caddyrepo || true
|
||||||
|
else
|
||||||
|
git -C /data/caddyrepo pull --ff-only || true
|
||||||
|
fi
|
||||||
|
if [ -f "/data/caddyrepo/Caddyfile" ]; then
|
||||||
|
cp "/data/caddyrepo/Caddyfile" /data/caddy/Caddyfile
|
||||||
|
fi
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user