fdroid-repository/docker-entrypoint.sh

38 lines
1.0 KiB
Bash
Raw Normal View History

2018-11-09 09:29:18 +01:00
#!/bin/bash
set -xeo pipefail
if [ ! -f /fdroid/host_ssh/ssh_host_rsa_key ]; then
2018-11-10 11:34:16 +01:00
echo "Generating host SSH key..."
mkdir -p /fdroid/host_ssh
ssh-keygen -f /fdroid/host_ssh/ssh_host_rsa_key -N '' -t rsa
chown fdroid: /fdroid/host_ssh/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
find /fdroid -not -user fdroid | xargs chown 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