1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/adguardhome_ynh.git synced 2024-09-03 18:06:23 +02:00
This commit is contained in:
ericgaspar 2021-07-06 17:56:56 +02:00
parent 6a5d3739c5
commit ca497382c6
2 changed files with 14 additions and 29 deletions

View file

@ -6,7 +6,7 @@
# IMPORT GENERIC HELPERS
#=================================================
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
@ -24,54 +24,38 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --time --weight=1
ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
domain=$(ynh_app_setting_get --app="$app" --key=domain)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
#=================================================
# STANDARD BACKUP STEPS
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --time --weight=1
ynh_systemd_action --service_name="$app" --action="stop" --log_path="/var/log/$app/$app.log"
ynh_print_info --message="Declaring files to be backed up..."
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Backing up the main app directory..." --time --weight=1
ynh_backup --src_path="$final_path"
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Backing up nginx web server configuration..." --time --weight=1
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_script_progression --message="Backing up systemd configuration..." --time --weight=1
ynh_backup --src_path="/etc/systemd/system/$app.service"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --time --weight=1
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --time --last
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -66,9 +66,13 @@ ynh_install_app_dependencies libcap2-bin libaprutil1
ynh_script_progression --message="Finding an available port..." --time --weight=1
# Find an available port
port=$(ynh_find_port --port=8095)
port=$(ynh_find_port --port=3000)
ynh_app_setting_set --app=$app --key=port --value=$port
# Disable the port 53 for upnp
ynh_exec_fully_quiet yunohost firewall disallow Both 53 --no-reload
ynh_exec_fully_quiet yunohost firewall allow Both 53 --no-upnp
#=================================================
# CREATE DEDICATED USER
#=================================================
@ -103,14 +107,11 @@ ynh_add_nginx_config
#=================================================
ynh_script_progression --message="Modifying a config file..." --weight=1
config_path="/var/lib/$app"
mkdir -p "$config_path"
# Main config File
ynh_add_config --template="../conf/AdGuardHome.yaml" --destination="$final_path/AdGuardHome.yaml"
chmod 600 "$config_path/navidrome.toml"
chown -R $app "$config_path"
chmod 600 "$final_path/AdGuardHome.yaml"
chown -R $app "$final_path/AdGuardHome.yaml"
#=================================================
# SETUP SYSTEMD