Robert Kaussow
54b589b46d
All checks were successful
continuous-integration/drone/pr Build is passing
62 lines
2.0 KiB
Bash
Executable File
62 lines
2.0 KiB
Bash
Executable File
#!/usr/bin/env sh
|
|
|
|
# shellcheck disable=SC1091
|
|
. /usr/local/lib/log.sh
|
|
|
|
/usr/local/bin/gomplate -o /etc/php81/php.ini -f /etc/templates/php.ini.tmpl
|
|
/usr/local/bin/gomplate -o /var/www/app/constants.local.php -f /etc/templates/constants.local.php.tmpl
|
|
|
|
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
|
|
|
|
log_info "Prepare FreshRSS"
|
|
/usr/bin/php -f ./cli/prepare.php >/dev/null 2>&1
|
|
|
|
ERROR=$(/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:-admin}" \
|
|
--language "${FRESHRSS_LANGUAGE:-en}" \
|
|
2>&1)
|
|
EXITCODE=$?
|
|
|
|
if [ $EXITCODE -eq 3 ]; then
|
|
log_info "FreshRSS already installed, skipped"
|
|
elif [ $EXITCODE -eq 0 ]; then
|
|
log_info "FreshRSS successfully installed"
|
|
else
|
|
log_error "FreshRSS error during installation: ${ERROR}"
|
|
exit $EXITCODE
|
|
fi
|
|
|
|
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}"
|
|
./cli/access-permissions.sh
|
|
else
|
|
log_error "FreshRSS error during the creation of a user: ${ERROR}"
|
|
exit $EXITCODE
|
|
fi
|
|
|
|
/usr/local/bin/gomplate -o /var/www/app/data/config.php -f /etc/templates/config.php.tmpl
|
|
|
|
log_info "Start FreshRSS Server\n"
|
|
supercronic /etc/crontabs/nginx &
|
|
php-fpm81 -F &
|
|
exec nginx -g "daemon off;"
|