mirror of
https://github.com/YunoHost-Apps/freshrss_ynh.git
synced 2024-09-03 18:36:33 +02:00
cleaning
This commit is contained in:
parent
d3f4f9ca0b
commit
9bfbcb6ee5
5 changed files with 34 additions and 86 deletions
|
@ -47,7 +47,6 @@ ram.runtime = "50M"
|
||||||
|
|
||||||
[install.admin]
|
[install.admin]
|
||||||
type = "user"
|
type = "user"
|
||||||
optional = false
|
|
||||||
|
|
||||||
[resources]
|
[resources]
|
||||||
[resources.sources.main]
|
[resources.sources.main]
|
||||||
|
|
|
@ -21,63 +21,41 @@ chmod -R o-rwx "$install_dir"
|
||||||
chown -R $app:www-data "$install_dir"
|
chown -R $app:www-data "$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# SYSTEM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring PHP-FPM..." --weight=1
|
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
||||||
|
|
||||||
# Create a dedicated PHP-FPM config
|
# Create a dedicated PHP-FPM config
|
||||||
ynh_add_fpm_config
|
ynh_add_fpm_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC SETUP
|
|
||||||
#=================================================
|
|
||||||
# SETUPING FRESHRSS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="FreshRSS setup script..." --weight=1
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Creating users..." --weight=1
|
|
||||||
|
|
||||||
for myuser in $(ynh_user_list)
|
|
||||||
do
|
|
||||||
user_token=$(ynh_string_random)
|
|
||||||
ynh_exec_as $app $install_dir/cli/create-user.php --user $myuser --language $language --token $user_token
|
|
||||||
done
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SETUP A CRON
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Setting up cron..." --weight=1
|
|
||||||
|
|
||||||
ynh_add_config --template="../conf/freshrss.cron" --destination="/etc/cron.d/$app"
|
ynh_add_config --template="../conf/freshrss.cron" --destination="/etc/cron.d/$app"
|
||||||
chown root: "/etc/cron.d/$app"
|
chown root: "/etc/cron.d/$app"
|
||||||
chmod 644 "/etc/cron.d/$app"
|
chmod 644 "/etc/cron.d/$app"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
|
||||||
# SETUP LOGROTATE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring log rotation..." --weight=1
|
|
||||||
|
|
||||||
log_path="/var/log/$app"
|
log_path="/var/log/$app"
|
||||||
mkdir -p $log_path
|
mkdir -p $log_path
|
||||||
chown $app:www-data $log_path
|
chown $app:www-data $log_path
|
||||||
# Use logrotate to manage application logfile(s)
|
# Use logrotate to manage application logfile(s)
|
||||||
ynh_use_logrotate
|
ynh_use_logrotate
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC SETUP
|
||||||
|
#=================================================
|
||||||
|
# SETUPING FRESHRSS
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="FreshRSS setup..." --weight=1
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
for myuser in $(ynh_user_list)
|
||||||
|
do
|
||||||
|
user_token=$(ynh_string_random)
|
||||||
|
ynh_exec_as $app $install_dir/cli/create-user.php --user $myuser --language $language --token $user_token
|
||||||
|
done
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -10,28 +10,18 @@ source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE NGINX CONFIGURATION
|
# REMOVE SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
|
# REMOVE SYSTEMD SERVICE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
||||||
|
|
||||||
# Remove the dedicated NGINX config
|
# Remove the dedicated NGINX config
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE PHP-FPM CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1
|
|
||||||
|
|
||||||
# Remove the dedicated PHP-FPM config
|
# Remove the dedicated PHP-FPM config
|
||||||
ynh_remove_fpm_config
|
ynh_remove_fpm_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC REMOVE
|
|
||||||
#=================================================
|
|
||||||
# REMOVE VARIOUS FILES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing various files..." --weight=1
|
|
||||||
|
|
||||||
# Remove a cron file
|
# Remove a cron file
|
||||||
ynh_secure_remove --file="/etc/cron.d/$app"
|
ynh_secure_remove --file="/etc/cron.d/$app"
|
||||||
|
|
||||||
|
|
|
@ -20,20 +20,6 @@ ynh_restore_file --origin_path="$install_dir"
|
||||||
chmod -R o-rwx "$install_dir"
|
chmod -R o-rwx "$install_dir"
|
||||||
chown -R $app:www-data "$install_dir"
|
chown -R $app:www-data "$install_dir"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE THE PHP-FPM CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=5
|
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
|
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE MYSQL DATABASE
|
# RESTORE THE MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -42,17 +28,18 @@ ynh_script_progression --message="Restoring the MySQL database..." --weight=1
|
||||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE VARIOUS FILES
|
# RESTORE SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring various files..." --weight=1
|
# RESTORE THE PHP-FPM CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
||||||
|
|
||||||
|
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||||
|
|
||||||
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE THE LOGROTATE CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
|
|
||||||
|
|
||||||
log_path="/var/log/$app"
|
log_path="/var/log/$app"
|
||||||
mkdir -p $log_path
|
mkdir -p $log_path
|
||||||
chown $app:www-data $log_path
|
chown $app:www-data $log_path
|
||||||
|
@ -61,9 +48,9 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX AND PHP-FPM
|
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
|
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
|
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
|
@ -22,19 +22,13 @@ upgrade_type=$(ynh_check_app_version_changed)
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||||
|
|
||||||
# If db_name doesn't exist, create it
|
|
||||||
if [ -z "$db_name" ]; then
|
|
||||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
|
||||||
#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$admin" ]; then
|
if [ -z "$admin" ]; then
|
||||||
#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin_user)
|
admin=$(ynh_app_setting_get --app=$app --key=admin_user)
|
||||||
if [ -z $admin ]; then
|
if [ -z $admin ]; then
|
||||||
ynh_die --message="no admin user found"
|
ynh_die --message="no admin user found"
|
||||||
fi;
|
fi;
|
||||||
ynh_app_setting_delete --app=$app --key=admin_user
|
ynh_app_setting_delete --app=$app --key=admin_user
|
||||||
#REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin
|
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -91,7 +85,7 @@ if [ -f /tmp/FreshRSS.log ]; then
|
||||||
ynh_secure_remove --file="/tmp/FreshRSS.log"
|
ynh_secure_remove --file="/tmp/FreshRSS.log"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f /var/www/$app/$app.log ]; then
|
if [ -f $install_dir/$app.log ]; then
|
||||||
ynh_secure_remove --file="/var/www/$app/$app.log"
|
ynh_secure_remove --file="/var/www/$app/$app.log"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue