2014-07-23 15:52:50 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-07-21 12:18:50 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2016-09-01 08:31:03 +02:00
|
|
|
|
2018-07-21 12:18:50 +02:00
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
2017-02-13 22:30:35 +01:00
|
|
|
|
2019-02-21 08:05:10 +01:00
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
2022-10-02 23:03:44 +02:00
|
|
|
ynh_script_progression --message="Setting up source files..." --weight=1
|
2019-02-21 08:05:10 +01:00
|
|
|
|
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
2023-06-29 19:08:38 +02:00
|
|
|
ynh_setup_source --dest_dir="$install_dir"
|
2019-02-21 08:05:10 +01:00
|
|
|
|
2023-06-29 19:08:38 +02:00
|
|
|
chmod -R o-rwx "$install_dir"
|
2023-11-01 16:57:59 +01:00
|
|
|
chown -R "$app":www-data "$install_dir"
|
2021-04-17 18:39:02 +02:00
|
|
|
|
2019-02-21 08:05:10 +01:00
|
|
|
#=================================================
|
2023-06-29 19:08:38 +02:00
|
|
|
# SYSTEM CONFIGURATION
|
2019-02-21 08:05:10 +01:00
|
|
|
#=================================================
|
2023-06-29 19:08:38 +02:00
|
|
|
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
2019-02-21 08:05:10 +01:00
|
|
|
|
2020-09-04 22:24:17 +02:00
|
|
|
# Create a dedicated PHP-FPM config
|
2023-09-29 18:53:41 +02:00
|
|
|
ynh_add_fpm_config
|
2022-10-02 23:03:44 +02:00
|
|
|
|
|
|
|
# Create a dedicated NGINX config
|
|
|
|
ynh_add_nginx_config
|
|
|
|
|
2024-05-12 17:39:01 +02:00
|
|
|
ynh_add_config --template="freshrss.cron" --destination="/etc/cron.d/$app"
|
2021-08-28 10:54:58 +02:00
|
|
|
chown root: "/etc/cron.d/$app"
|
2021-06-28 22:23:04 +02:00
|
|
|
chmod 644 "/etc/cron.d/$app"
|
2019-02-21 08:05:10 +01:00
|
|
|
|
2022-10-31 22:24:46 +01:00
|
|
|
log_path="/var/log/$app"
|
2023-11-01 16:57:59 +01:00
|
|
|
mkdir -p "$log_path"
|
|
|
|
chown "$app":www-data "$log_path"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALIZATION
|
|
|
|
#=================================================
|
|
|
|
# SETUP LOGROTATE
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Configuring log rotation..." --weight=1
|
|
|
|
|
2022-10-03 00:00:06 +02:00
|
|
|
# Use logrotate to manage application logfile(s)
|
|
|
|
ynh_use_logrotate
|
|
|
|
|
2023-11-01 16:57:59 +01:00
|
|
|
#=================================================
|
|
|
|
# SETUP FAIL2BAN
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Upgrading fail2ban configuration..."
|
|
|
|
|
|
|
|
# Create the logfile, required before configuring fail2ban
|
|
|
|
touch "/var/log/${domain}-access.log"
|
|
|
|
|
|
|
|
# Create a dedicated Fail2Ban config
|
|
|
|
ynh_add_fail2ban_config --logpath="/var/log/${domain}-access.log" --failregex="<HOST> .* \"GET /api/.*\" 401" --max_retry=5
|
|
|
|
|
2022-10-03 00:00:06 +02:00
|
|
|
#=================================================
|
2023-06-29 19:08:38 +02:00
|
|
|
# SPECIFIC SETUP
|
2019-02-21 08:05:10 +01:00
|
|
|
#=================================================
|
2023-06-29 19:08:38 +02:00
|
|
|
# SETUPING FRESHRSS
|
2019-02-21 08:05:10 +01:00
|
|
|
#=================================================
|
2024-05-12 17:39:01 +02:00
|
|
|
ynh_script_progression --message="$app setup..." --weight=1
|
2023-06-29 19:08:38 +02:00
|
|
|
|
2023-11-01 16:57:59 +01:00
|
|
|
ynh_exec_warn_less ynh_exec_as "$app" "$install_dir/cli/do-install.php" --default_user "$admin" --auth_type http_auth --environment production --base_url "https://$domain$path" --title FreshRSS --api_enabled --db-type mysql --db-host localhost --db-user "$db_name" --db-password "$db_pwd" --db-base "$db_name"
|
2019-02-21 08:05:10 +01:00
|
|
|
|
2023-06-29 19:08:38 +02:00
|
|
|
for myuser in $(ynh_user_list)
|
|
|
|
do
|
|
|
|
user_token=$(ynh_string_random)
|
2023-11-01 16:57:59 +01:00
|
|
|
ynh_exec_as "$app" "$install_dir/cli/create-user.php" --user "$myuser" --language "$language" --token "$user_token"
|
2023-06-29 19:08:38 +02:00
|
|
|
done
|
2019-02-21 08:05:10 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2020-09-04 22:24:17 +02:00
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|