entrypoint.sh 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. echo "export DATA_PATH=$DATA_PATH"
  20. ) >/var/www/FreshRSS/Docker/env.txt
  21. sed </etc/crontab.freshrss.default \
  22. -r "s#^[^ ]+ #$CRON_MIN #" | crontab -
  23. fi
  24. ./cli/access-permissions.sh
  25. php -f ./cli/prepare.php >/dev/null
  26. if [ -n "$FRESHRSS_INSTALL" ]; then
  27. # shellcheck disable=SC2046
  28. php -f ./cli/do-install.php -- \
  29. $(echo "$FRESHRSS_INSTALL" | sed -r 's/[\r\n]+/\n/g' | paste -s -)
  30. EXITCODE=$?
  31. if [ $EXITCODE -eq 3 ]; then
  32. echo 'ℹ️ FreshRSS already installed; no change performed.'
  33. elif [ $EXITCODE -eq 0 ]; then
  34. echo '✅ FreshRSS successfully installed.'
  35. else
  36. echo '❌ FreshRSS error during installation!'
  37. exit $EXITCODE
  38. fi
  39. fi
  40. if [ -n "$FRESHRSS_USER" ]; then
  41. # shellcheck disable=SC2046
  42. php -f ./cli/create-user.php -- \
  43. $(echo "$FRESHRSS_USER" | sed -r 's/[\r\n]+/\n/g' | paste -s -)
  44. EXITCODE=$?
  45. if [ $EXITCODE -eq 3 ]; then
  46. echo 'ℹ️ FreshRSS user already exists; no change performed.'
  47. elif [ $EXITCODE -eq 0 ]; then
  48. echo '✅ FreshRSS user successfully created.'
  49. ./cli/list-users.php | xargs -n1 ./cli/actualize-user.php --user
  50. else
  51. echo '❌ FreshRSS error during the creation of a user!'
  52. exit $EXITCODE
  53. fi
  54. fi
  55. ./cli/access-permissions.sh
  56. exec "$@"