1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/gogs_ynh.git synced 2024-09-03 20:36:23 +02:00
This commit is contained in:
ericgaspar 2022-01-11 12:04:14 +01:00
parent 70a7923920
commit a7e43ac90f
No known key found for this signature in database
GPG key ID: 574F281483054D44
2 changed files with 33 additions and 9 deletions

View file

@ -52,6 +52,12 @@ ynh_backup --src_path="$DATADIR"
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP LOGROTATE
#=================================================
ynh_backup --src_path="/etc/logrotate.d/$app"
#================================================= #=================================================
# BACKUP SYSTEMD # BACKUP SYSTEMD
#================================================= #=================================================

View file

@ -29,7 +29,6 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
# Retrieve old app settings # Retrieve old app settings
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path) path_url=$(ynh_app_setting_get --app=$app --key=path)
dbpass=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
admin=$(ynh_app_setting_get --app=$app --key=adminusername) admin=$(ynh_app_setting_get --app=$app --key=adminusername)
# Check user parameter # Check user parameter
@ -51,13 +50,28 @@ test getent passwd "$app" &>/dev/null || \
# Restore all files # Restore all files
ynh_restore ynh_restore
# Create and restore the database #=================================================
ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass" # RESTORE THE MYSQL DATABASE
ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < ./db.sql #=================================================
ynh_script_progression --message="Restoring the MySQL database..." --weight=1
# Restore systemd files dbpass=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
systemctl daemon-reload ynh_mysql_setup_db --db_user=$dbuser --db_name=$dbname --db_pwd=$dbpass
systemctl enable "$app".service --quiet ynh_mysql_connect_as --user=$dbuser --password=$dbpass --database=$dbname < ./db.sql
#=================================================
# RESTORE VARIOUS FILES
#=================================================
ynh_script_progression --message="Restoring various files..." --time --weight=1
#=================================================
# RESTORE SYSTEMD
#=================================================
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
@ -69,8 +83,12 @@ set_permission
# Configure logrotate # Configure logrotate
ynh_use_logrotate "/var/log/$app" ynh_use_logrotate "/var/log/$app"
# Add Gogs to YunoHost's monitored services #=================================================
yunohost service add "$app" --log /var/log/"$app"/"$app".log # RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..." --time --weight=1
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST