Skip to content

Commit

Permalink
v8.10 (#5768)
Browse files Browse the repository at this point in the history
- DietPi-Software | FreshRSS: Resolved an issue where the install failed because of changed branches on the GitHub repository. Many thanks to @baptiste313 for reporting this issue: #5767
- DietPi-Software | FreshRSS: Apply strong random database password on fresh installs and add further CLI steps beneficial for reinstalls

Co-authored-by: MichaIng <[email protected]>
  • Loading branch information
Joulinar and MichaIng authored Sep 26, 2022
1 parent 274b05a commit d63fef0
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 18 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Enhancements:

Bug fixes:
- DietPi-Drive_Manager | Resolved an issue where it was not possible to disable the swap file with less than 2 GiB available free space on that drive. The check was meant to prevent the creation of a swap file with limited free space, while disabling/removing a swap file should of course always be possible. Furthermore the 2 GiB free space requirement has been removed completely, which has no point on non-system drives and is too strict even on system drives which, depending on the setup, can run fine with much less free space. Many thanks to @symbios24 for reporting this issue: https://github.com/MichaIng/DietPi/issues/5749#issuecomment-1257169750
- DietPi-Software | FreshRSS: Resolved an issue where the install failed because of changed branches on the GitHub repository. Many thanks to @baptiste313 for reporting this issue: https://github.com/MichaIng/DietPi/issues/5767

As always, many smaller code performance and stability improvements, visual and spelling fixes have been done, too much to list all of them here. Check out all code changes of this release on GitHub: https://github.com/MichaIng/DietPi/pull/XXXX

Expand Down
50 changes: 32 additions & 18 deletions dietpi/dietpi-software
Original file line number Diff line number Diff line change
Expand Up @@ -7532,7 +7532,7 @@ _EOF_

Banner_Installing

# Install required PHP modules: https://github.com/FreshRSS/FreshRSS#example-of-full-installation-on-linux-debianubuntu
# Install required PHP modules: https://github.com/FreshRSS/FreshRSS#requirements
aDEPS=("php$PHP_VERSION-curl" "php$PHP_VERSION-gmp" "php$PHP_VERSION-intl" "php$PHP_VERSION-mbstring" "php$PHP_VERSION-xml" "php$PHP_VERSION-zip")
# - Add JSON module for PHP7, as it does not exist (embedded in core package) on PHP8
local json=()
Expand All @@ -7548,35 +7548,46 @@ _EOF_
G_AGI "${aDEPS[@]}"
aDEPS=()
else
Download_Install 'https://github.com/FreshRSS/FreshRSS/archive/master.tar.gz' /opt
G_EXEC mv /opt/FreshRSS-master /opt/FreshRSS
local version=$(curl -sSfL 'https://api.github.com/repos/FreshRSS/FreshRSS/releases/latest' | mawk -F\" '/"tag_name": /{print $4}')
[[ $version ]] || { version='1.20.0'; G_DIETPI-NOTIFY 1 "Automatic latest FreshRSS version detection failed. Version \"$version\" will be installed as fallback, but a newer version might be available. Please report this at: https://github.com/MichaIng/DietPi/issues"; }
Download_Install "https://github.com/FreshRSS/FreshRSS/archive/$version.tar.gz"
G_EXEC mv "FreshRSS-$version" /opt/FreshRSS
fi

# Enable required PHP modules: https://github.com/FreshRSS/FreshRSS#requirements
G_EXEC phpenmod curl gmp intl pdo_mysql ctype dom mbstring xml zip "${json[@]}"
G_EXEC phpenmod curl gmp iconv intl pdo_mysql ctype dom mbstring xml zip "${json[@]}"

# Apache configuration
if (( ${aSOFTWARE_INSTALL_STATE[83]} > 0 )); then

# Required modules
G_EXEC a2enmod headers expires rewrite
# Apache config
if (( ${aSOFTWARE_INSTALL_STATE[83]} > 0 ))
then
# Required modules: https://github.com/FreshRSS/FreshRSS/blob/edge/p/.htaccess, https://github.com/FreshRSS/FreshRSS/blob/edge/p/api/.htaccess, https://github.com/FreshRSS/FreshRSS/blob/edge/p/themes/.htaccess
# - Do not enable mod_deflate since it may cause issues with concurrent ownCloud and Nextcloud installs: https://docs.nextcloud.com/server/latest/admin_manual/issues/general_troubleshooting.html#web-server-and-php-modules
G_EXEC a2enmod dir mime expires headers setenvif

# Better compatibility with mobile clients
echo 'AllowEncodedSlashes On' > /etc/apache2/conf-available/dietpi-freshrss.conf
cat << '_EOF_' > /etc/apache2/conf-available/dietpi-freshrss.conf
# Based on: https://freshrss.github.io/FreshRSS/en/admins/10_ServerConfig.html
<Directory /var/www/freshrss>
AllowOverride AuthConfig FileInfo Indexes Limit
Require all granted
Options FollowSymLinks
</Directory>
AllowEncodedSlashes On
_EOF_
G_EXEC a2enconf dietpi-freshrss

fi

# Create MariaDB database and user
if [[ -d '/mnt/dietpi_userdata/mysql/freshrss' ]]; then

# - Create random alphanumeric 30 characters password
local password=$(tr -dc '[:alnum:]' < /dev/random | head -c30)
if [[ -d '/mnt/dietpi_userdata/mysql/freshrss' ]]
then
G_DIETPI-NOTIFY 2 'FreshRSS MariaDB database found, will NOT overwrite.'
G_EXEC systemctl restart mariadb

# Update database password if do-install.php applies it to the FreshRSS config
[[ -f '/opt/FreshRSS/data/applied_migrations.txt' ]] || mysql -e "grant all privileges on \`freshrss\`.* to 'freshrss'@localhost identified by '$password';flush privileges"
else

/boot/dietpi/func/create_mysql_db freshrss freshrss "$GLOBAL_PW"

/boot/dietpi/func/create_mysql_db freshrss freshrss "$password"
fi

# Set permissions for webserver access
Expand All @@ -7586,8 +7597,11 @@ _EOF_
# CLI install: https://github.com/FreshRSS/FreshRSS/blob/master/cli/README.md#commands
G_EXEC cd /opt/FreshRSS
sudo -u www-data php ./cli/prepare.php
sudo -u www-data php ./cli/do-install.php --default_user dietpi --auth_type form --environment production --title FreshRSS --db-type mysql --db-host localhost --db-user freshrss --db-password "$GLOBAL_PW" --db-base freshrss --db-prefix freshrss
sudo -u www-data php ./cli/do-install.php --default_user dietpi --auth_type form --environment production --title FreshRSS --db-type mysql --db-host localhost --db-user freshrss --db-password "$password" --db-base freshrss --db-prefix freshrss
unset -v password
sudo -u www-data php ./cli/create-user.php --user dietpi --password "$GLOBAL_PW" --api_password "$GLOBAL_PW"
sudo -u www-data php ./cli/actualize-user.php --user dietpi
sudo -u www-data php ./cli/db-optimize.php --user dietpi
G_EXEC cd "$G_WORKING_DIR"

# Link web interface to webroot
Expand Down

0 comments on commit d63fef0

Please sign in to comment.