fdroid-repository/docker-entrypoint.sh

37 lines
970 B
Bash
Raw Normal View History

2018-11-09 09:29:18 +01:00
#!/bin/bash
set -xeo pipefail
2018-11-10 11:34:16 +01:00
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
2018-11-09 09:29:18 +01:00
fi
2018-11-10 11:34:16 +01:00
mkdir -p /fdroid/.ssh
if [ ! -z "${SSH_PUBLIC_KEY}" ]; then
echo "${SSH_PUBLIC_KEY}" > /fdroid/.ssh/authorized_keys
fi
2018-11-10 11:34:16 +01:00
chmod 0600 /fdroid/.ssh/authorized_keys
2018-11-09 09:29:18 +01:00
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
2018-11-09 09:29:18 +01:00
2018-11-10 11:34:16 +01:00
chown -R fdroid: /fdroid
2018-11-09 09:29:18 +01:00
su fdroid /fdroid/fdroid-update.sh
2018-11-10 11:34:16 +01:00
/usr/bin/supervisord -c /etc/supervisor.d/supervisor.ini