diff --git a/actions.toml b/actions.toml deleted file mode 100644 index 245a703..0000000 --- a/actions.toml +++ /dev/null @@ -1,8 +0,0 @@ -[reset_default_config] -name = "Reset the AdguardHome config" -command = "/bin/bash scripts/actions/reset_default_config" -# user = "root" # optional -# cwd = "/" # optional -# accepted_return_codes = [0, 1, 2, 3] # optional -accepted_return_codes = [0] -description = "Reset the AdguardHome config for this app." \ No newline at end of file diff --git a/scripts/actions/reset_default_config b/scripts/actions/reset_default_config deleted file mode 100644 index 45109c7..0000000 --- a/scripts/actions/reset_default_config +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash - -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - -source scripts/_common.sh -source /usr/share/yunohost/helpers - -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -app=$YNH_APP_INSTANCE_NAME - -admin=$(ynh_app_setting_get --app=$app --key=admin) -password=$(ynh_app_setting_get --app=$app --key=password) -install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -port=$(ynh_app_setting_get --app=$app --key=port) -port_adguard=$(ynh_app_setting_get --app=$app --key=port_adguard) -dns_over_https=$(ynh_app_setting_get --app=$app --key=dns_over_https) - -ipv4_route_output=$(echo "$(ip -4 route get 1.2.3.4 2> /dev/null)" | head -n1) -ipv6_route_output=$(echo "$(ip -6 route get ::1.2.3.4 2> /dev/null)" | head -n1) - -ipv4_addr="" -for i in $(seq "$(echo $ipv4_route_output | wc -w)" -1 1); do - ip=$(echo $ipv4_route_output | awk "{print \$$i}") - if ynh_validate_ip4 --ip_address=$ip; then - ipv4_addr="- $ip" - break - fi -done - -ipv6_addr="" -for i in $(seq "$(echo $ipv6_route_output | wc -w)" -1 1); do - ip=$(echo $ipv6_route_output | awk "{print \$$i}") - if ynh_validate_ip6 --ip_address=$ip; then - ipv6_addr="- $ip" - break - fi -done - -#================================================= -# RESET THE CONFIG FILE -#================================================= -ynh_script_progression --message="Updating a configuration file..." --weight=1 - -ynh_add_config --template="../conf/AdGuardHome.yaml" --destination="$install_dir/AdGuardHome.yaml" - -#================================================= -# RESTART SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Restarting a systemd service..." --weight=1 - -ynh_systemd_action --service_name=$app --action="restart"