37 lines
970 B
Bash
37 lines
970 B
Bash
#!/bin/bash
|
|
|
|
set -xeo pipefail
|
|
|
|
if [ ! -f /fdroid/ssh_host_rsa_key ]; then
|
|
echo "Generating host SSH key..."
|
|
ssh-keygen -f /fdroid/ssh_host_rsa_key -N '' -t rsa
|
|
chown fdroid: /fdroid/ssh_host_rsa_key
|
|
fi
|
|
|
|
mkdir -p /fdroid/.ssh
|
|
|
|
if [ ! -z "${SSH_PUBLIC_KEY}" ]; then
|
|
echo "${SSH_PUBLIC_KEY}" > /fdroid/.ssh/authorized_keys
|
|
fi
|
|
|
|
chmod 0600 /fdroid/.ssh/authorized_keys
|
|
|
|
if [ ! -f /fdroid/keystore/keystore.jks ]; then
|
|
keytool -genkey -noprompt \
|
|
-keyalg RSA \
|
|
-alias "${FDROID_KEYSTORE_KEY_ALIAS}" \
|
|
-dname "${FDROID_KEYSTORE_DNAME}" \
|
|
-keystore /fdroid/keystore/keystore.jks \
|
|
-storepass "${FDROID_KEYSTORE_PASS}" \
|
|
-keypass "${FDROID_KEYSTORE_KEYPASS}"
|
|
fi
|
|
|
|
echo "Updating configuration from environment..."
|
|
envsubst < config.yml.tmpl > /fdroid/config.yml
|
|
chmod 0600 /fdroid/config.yml
|
|
|
|
chown -R fdroid: /fdroid
|
|
|
|
su fdroid /fdroid/fdroid-update.sh
|
|
|
|
/usr/bin/supervisord -c /etc/supervisor.d/supervisor.ini |