This repository has been archived on 2023-11-05. You can view files and clone it, but cannot push or open issues or pull requests.
freshrss/overlay/usr/local/bin/entrypoint

54 lines
2.0 KiB
Plaintext
Raw Normal View History

2020-02-21 22:54:20 +00:00
#!/usr/bin/env sh
2020-12-31 12:22:05 +00:00
/usr/local/bin/gomplate -o /etc/php7/php.ini -f /etc/templates/php.ini.tmpl
/usr/local/bin/gomplate -o /var/www/app/data/config.php -f /etc/templates/config.php.tmpl
/usr/local/bin/gomplate -o /var/www/app/constants.local.php -f /etc/templates/constants.local.php.tmpl
2019-10-02 07:43:32 +00:00
2020-02-21 22:54:20 +00:00
if [ -n "${FRESHRSS_POSTGRES_SSL_ROOTCERT}" ] && [ ! -f "/var/www/.postgresql/root.crt" ]; then
ln -s "${FRESHRSS_POSTGRES_SSL_ROOTCERT}" /var/www/.postgresql/root.crt
fi
printf "\nPrepare FreshRSS...\n"
/usr/bin/php -f ./cli/prepare.php >/dev/null 2>&1
/usr/bin/php -f ./cli/do-install.php -- --api_enabled \
--base_url "${FRESHRSS_BASE_URL:-http://localhost/}" \
--db-base "${FRESHRSS_DB_BASE}" \
--db-host "${FRESHRSS_DB_HOST:-localhost}" \
--db-password "${FRESHRSS_DB_PASSWORD}" \
--db-type "${FRESHRSS_DB_TYPE:-sqlite}" \
--db-user "${FRESHRSS_DB_USER}" \
--default_user "${FRESHRSS_DEFAULT_USER:-_}" \
--language "${FRESHRSS_LANGUAGE:-en}" >/dev/null 2>&1
EXITCODE=$?
if [ $EXITCODE -eq 3 ]; then
printf 'FreshRSS already installed, no change performed\n'
elif [ $EXITCODE -eq 0 ]; then
printf 'FreshRSS successfully installed\n'
else
printf 'FreshRSS error during installation\n'
exit $EXITCODE
fi
2019-10-02 07:43:32 +00:00
if [ "${FRESHRSS_DEFAULT_USER}" ]; then
printf "\nEnsure default user exists...\n"
/usr/bin/php ./cli/create-user.php --user "$FRESHRSS_DEFAULT_USER" --password "$FRESHRSS_DEFAULT_PASSWORD" --language "${FRESHRSS_LANGUAGE:-en}" >/dev/null 2>&1
EXITCODE=$?
if [ $EXITCODE -eq 3 ]; then
printf 'FreshRSS user already exists, no change performed\n'
elif [ $EXITCODE -eq 0 ]; then
printf 'FreshRSS user successfully created\n'
./cli/list-users.php | xargs -n1 ./cli/actualize-user.php --user "$FRESHRSS_DEFAULT_USER"
else
rm -f /tmp/out.txt /tmp/err.txt
printf 'FreshRSS error during the creation of a user\n'
exit $EXITCODE
fi
2019-10-02 07:43:32 +00:00
fi
2019-10-09 08:01:15 +00:00
supercronic /etc/crontabs/nginx &
php-fpm7 -F &
2019-10-02 07:43:32 +00:00
exec nginx -g "daemon off;"