2020-02-21 22:54:20 +00:00
|
|
|
#!/usr/bin/env sh
|
2019-10-03 11:46:02 +00:00
|
|
|
|
2021-10-09 20:02:53 +00:00
|
|
|
# shellcheck disable=SC1091
|
|
|
|
. /usr/local/lib/log.sh
|
|
|
|
|
2022-11-25 13:21:45 +00:00
|
|
|
/usr/local/bin/gomplate -o /etc/php81/php.ini -f /etc/templates/php.ini.tmpl
|
2020-12-31 12:22:05 +00:00
|
|
|
/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
|
2019-10-05 13:30:54 +00:00
|
|
|
ln -s "${FRESHRSS_POSTGRES_SSL_ROOTCERT}" /var/www/.postgresql/root.crt
|
|
|
|
fi
|
|
|
|
|
2021-10-09 20:02:53 +00:00
|
|
|
log_info "Prepare FreshRSS"
|
2021-06-07 22:01:38 +00:00
|
|
|
/usr/bin/php -f ./cli/prepare.php >/dev/null 2>&1
|
|
|
|
|
2021-10-09 20:02:53 +00:00
|
|
|
ERROR=$(/usr/bin/php -f ./cli/do-install.php -- --api_enabled \
|
2021-06-07 22:01:38 +00:00
|
|
|
--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}" \
|
2021-10-09 20:02:53 +00:00
|
|
|
--default_user "${FRESHRSS_DEFAULT_USER:-admin}" \
|
|
|
|
--language "${FRESHRSS_LANGUAGE:-en}" \
|
|
|
|
2>&1)
|
2021-06-07 22:01:38 +00:00
|
|
|
EXITCODE=$?
|
|
|
|
|
|
|
|
if [ $EXITCODE -eq 3 ]; then
|
2021-10-09 20:02:53 +00:00
|
|
|
log_info "FreshRSS already installed, skipped"
|
2021-06-07 22:01:38 +00:00
|
|
|
elif [ $EXITCODE -eq 0 ]; then
|
2021-10-09 20:02:53 +00:00
|
|
|
log_info "FreshRSS successfully installed"
|
2021-06-07 22:01:38 +00:00
|
|
|
else
|
2021-10-09 20:02:53 +00:00
|
|
|
log_error "FreshRSS error during installation: ${ERROR}"
|
2021-06-07 22:01:38 +00:00
|
|
|
exit $EXITCODE
|
2019-10-03 11:46:02 +00:00
|
|
|
fi
|
2019-10-02 07:43:32 +00:00
|
|
|
|
2022-11-25 13:15:55 +00:00
|
|
|
log_info "Ensure default user exists"
|
|
|
|
ERROR=$(/usr/bin/php ./cli/create-user.php \
|
|
|
|
--user "${FRESHRSS_DEFAULT_USER:-admin}" \
|
|
|
|
--password "${FRESHRSS_DEFAULT_PASSWORD:-freshrss}" \
|
|
|
|
--language "${FRESHRSS_LANGUAGE:-en}" \
|
|
|
|
2>&1)
|
|
|
|
EXITCODE=$?
|
|
|
|
|
|
|
|
if [ $EXITCODE -eq 3 ]; then
|
|
|
|
log_info "FreshRSS user already exists, skipped"
|
|
|
|
elif [ $EXITCODE -eq 0 ]; then
|
|
|
|
log_info "FreshRSS user successfully created"
|
|
|
|
./cli/list-users.php | xargs -n1 ./cli/actualize-user.php --user "${FRESHRSS_DEFAULT_USER:-admin}"
|
2023-06-10 21:55:34 +00:00
|
|
|
./cli/access-permissions.sh
|
2022-11-25 13:15:55 +00:00
|
|
|
else
|
|
|
|
log_error "FreshRSS error during the creation of a user: ${ERROR}"
|
|
|
|
exit $EXITCODE
|
2019-10-02 07:43:32 +00:00
|
|
|
fi
|
|
|
|
|
2022-11-25 13:15:55 +00:00
|
|
|
/usr/local/bin/gomplate -o /var/www/app/data/config.php -f /etc/templates/config.php.tmpl
|
|
|
|
|
2021-10-09 20:02:53 +00:00
|
|
|
log_info "Start FreshRSS Server\n"
|
2019-10-09 08:01:15 +00:00
|
|
|
supercronic /etc/crontabs/nginx &
|
2022-11-25 13:21:45 +00:00
|
|
|
php-fpm81 -F &
|
2019-10-02 07:43:32 +00:00
|
|
|
exec nginx -g "daemon off;"
|