entrypoint.sh 1.9 KB

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