fdroid-repository/docker-entrypoint.sh

30 lines
826 B
Bash

#!/bin/bash
set -xeo pipefail
if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then
echo "Generating SSH key..."
sed -i "s/^#HostKey.*$/HostKey \/etc\/ssh\/ssh_host_rsa_key/" /etc/ssh/sshd_config
ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa
fi
mkdir -p /root/.ssh
echo "${SSH_RSA_PUBLIC_KEY}" > /root/.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.py.tmpl > config.py
chmod 0600 config.py
/fdroid-update.sh
/usr/bin/supervisord