scripts/bootstrap

50 lines
1.2 KiB
Text
Raw Normal View History

#!/bin/sh
echo "Weblate domain:"
read -r domain
2024-02-02 18:07:39 +01:00
cloud_domain="${domain%.weblate.cloud}"
2025-04-08 11:35:17 +02:00
if [ "$cloud_domain" = "$domain" ]; then
2025-07-16 15:11:55 +02:00
echo "Cloud domain (without .weblate.cloud):"
read -r cloud_domain
2024-02-02 18:07:39 +01:00
fi
echo "Weblate title:"
read -r title
2025-04-08 11:35:17 +02:00
if [ -f ~/.config/weblate-bootstrap/sentry_dsn ]; then
2025-07-16 15:11:55 +02:00
sentry=$(cat ~/.config/weblate-bootstrap/sentry_dsn)
2020-04-14 16:34:28 +02:00
else
2025-07-16 15:11:55 +02:00
echo "Sentry DSN:"
read -r sentry
2020-04-14 16:34:28 +02:00
fi
2025-04-08 11:35:17 +02:00
if [ -f ~/.config/weblate-bootstrap/sentry_token ]; then
2025-07-16 15:11:55 +02:00
sentry_token=$(cat ~/.config/weblate-bootstrap/sentry_token)
2020-04-14 16:34:28 +02:00
else
2025-07-16 15:11:55 +02:00
echo "Sentry Token:"
read -r sentry_token
2020-04-14 16:34:28 +02:00
fi
2025-04-08 11:35:17 +02:00
if [ -f ~/.config/weblate-bootstrap/graylog_token ]; then
2025-07-16 15:11:55 +02:00
graylog_token=$(cat ~/.config/weblate-bootstrap/graylog_token)
2024-12-07 12:44:24 +01:00
else
2025-07-16 15:11:55 +02:00
echo "Graylog Token:"
read -r graylog_token
2024-12-07 12:44:24 +01:00
fi
smtp_pass=$(openssl rand -hex 32)
2025-07-16 15:11:55 +02:00
cat > "${1:-/etc/weblate-bootstrap}" << EOT
WEBLATE_DOMAIN="$domain"
2024-02-02 18:07:39 +01:00
WEBLATE_CLOUD_DOMAIN="$cloud_domain"
WEBLATE_TITLE="$title"
WEBLATE_SECRET=$(openssl rand -hex 32)
WEBLATE_SENTRY="$sentry"
2020-04-14 15:23:07 +02:00
WEBLATE_SENTRY_TOKEN="$sentry_token"
2024-12-07 12:44:24 +01:00
WEBLATE_GRAYLOG_TOKEN="$graylog_token"
2021-10-27 12:29:21 +02:00
WEBLATE_VERSION="$2"
# Exim
EXIM_PASS=$smtp_pass
# $(openssl passwd -6 "$smtp_pass")
# Postgresql
POSTGRES_PASS=$(openssl rand -hex 32)
EOT