entrypoint.sh 1.9 KB

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