entrypoint.sh 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #!/bin/sh
  2. ln -snf "/usr/share/zoneinfo/$TZ" /etc/localtime
  3. echo "$TZ" >/etc/timezone
  4. find /etc/php*/ -type f -name php.ini -exec sed -r -i "\\#^;?date.timezone#s#^.*#date.timezone = $TZ#" {} \;
  5. find /etc/php*/ -type f -name php.ini -exec sed -r -i "\\#^;?post_max_size#s#^.*#post_max_size = 32M#" {} \;
  6. find /etc/php*/ -type f -name php.ini -exec sed -r -i "\\#^;?upload_max_filesize#s#^.*#upload_max_filesize = 32M#" {} \;
  7. if [ -n "$LISTEN" ]; then
  8. find /etc/apache2/ -type f -name FreshRSS.Apache.conf -exec sed -r -i "\\#^Listen#s#^.*#Listen $LISTEN#" {} \;
  9. fi
  10. if [ -n "$OIDC_ENABLED" ] && [ "$OIDC_ENABLED" -ne 0 ]; then
  11. a2enmod -q auth_openidc
  12. fi
  13. if [ -n "$CRON_MIN" ]; then
  14. (
  15. echo "export TZ=$TZ"
  16. echo "export COPY_LOG_TO_SYSLOG=$COPY_LOG_TO_SYSLOG"
  17. echo "export COPY_SYSLOG_TO_STDERR=$COPY_SYSLOG_TO_STDERR"
  18. echo "export FRESHRSS_ENV=$FRESHRSS_ENV"
  19. ) >/var/www/FreshRSS/Docker/env.txt
  20. sed </etc/crontab.freshrss.default \
  21. -r "s#^[^ ]+ #$CRON_MIN #" | crontab -
  22. fi
  23. ./cli/access-permissions.sh
  24. php -f ./cli/prepare.php >/dev/null
  25. if [ -n "$FRESHRSS_INSTALL" ]; then
  26. # shellcheck disable=SC2046
  27. php -f ./cli/do-install.php -- \
  28. $(echo "$FRESHRSS_INSTALL" | sed -r 's/[\r\n]+/\n/g' | paste -s -)
  29. EXITCODE=$?
  30. if [ $EXITCODE -eq 3 ]; then
  31. echo 'ℹ️ FreshRSS already installed; no change performed.'
  32. elif [ $EXITCODE -eq 0 ]; then
  33. echo '✅ FreshRSS successfully installed.'
  34. else
  35. echo '❌ FreshRSS error during installation!'
  36. exit $EXITCODE
  37. fi
  38. fi
  39. if [ -n "$FRESHRSS_USER" ]; then
  40. # shellcheck disable=SC2046
  41. php -f ./cli/create-user.php -- \
  42. $(echo "$FRESHRSS_USER" | sed -r 's/[\r\n]+/\n/g' | paste -s -)
  43. EXITCODE=$?
  44. if [ $EXITCODE -eq 3 ]; then
  45. echo 'ℹ️ FreshRSS user already exists; no change performed.'
  46. elif [ $EXITCODE -eq 0 ]; then
  47. echo '✅ FreshRSS user successfully created.'
  48. ./cli/list-users.php | xargs -n1 ./cli/actualize-user.php --user
  49. else
  50. echo '❌ FreshRSS error during the creation of a user!'
  51. exit $EXITCODE
  52. fi
  53. fi
  54. ./cli/access-permissions.sh
  55. exec "$@"