From 29896d6a800ec45f17d899a3338f87120b5db985 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 6 Apr 2023 09:05:31 +0200 Subject: [PATCH 01/13] v2 --- conf/amd64.src | 6 ---- conf/arm64.src | 6 ---- conf/armhf.src | 6 ---- conf/systemd.service | 6 ++-- manifest.toml | 70 ++++++++++++++++++++++++++++++++++++++ scripts/_common.sh | 2 +- scripts/backup | 14 ++++---- scripts/change_url | 64 ++++++++++++++++++----------------- scripts/install | 80 ++++++++++++++++++++++---------------------- scripts/remove | 24 ++++++------- scripts/restore | 40 +++++++++++----------- scripts/upgrade | 74 ++++++++++++++++++++-------------------- 12 files changed, 223 insertions(+), 169 deletions(-) delete mode 100644 conf/amd64.src delete mode 100644 conf/arm64.src delete mode 100644 conf/armhf.src create mode 100644 manifest.toml diff --git a/conf/amd64.src b/conf/amd64.src deleted file mode 100644 index c3c4070..0000000 --- a/conf/amd64.src +++ /dev/null @@ -1,6 +0,0 @@ -SOURCE_URL=https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.27/AdGuardHome_linux_amd64.tar.gz -SOURCE_SUM=98d06ff05e012475c9f3abe748cfb4b1f1244b78c1f1370c84cfba449e738183 -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=2 -SOURCE_EXTRACT=true diff --git a/conf/arm64.src b/conf/arm64.src deleted file mode 100644 index e7340a1..0000000 --- a/conf/arm64.src +++ /dev/null @@ -1,6 +0,0 @@ -SOURCE_URL=https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.27/AdGuardHome_linux_arm64.tar.gz -SOURCE_SUM=d89d3a46fa0a6498f7a918fa7e0e25f92eaca11fb9829082ba9709ef9820bc3f -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=2 -SOURCE_EXTRACT=true diff --git a/conf/armhf.src b/conf/armhf.src deleted file mode 100644 index 90e65dc..0000000 --- a/conf/armhf.src +++ /dev/null @@ -1,6 +0,0 @@ -SOURCE_URL=https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.27/AdGuardHome_linux_armv7.tar.gz -SOURCE_SUM=cb9fecbe03894b729b5092db823cbd54ea6883d5bbc46cb2c7de89b5d572ce39 -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=2 -SOURCE_EXTRACT=true diff --git a/conf/systemd.service b/conf/systemd.service index 8f278e9..2adca30 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -1,6 +1,6 @@ [Unit] Description=AdGuard Home: Network-level blocker -ConditionFileIsExecutable=__FINALPATH__/AdGuardHome +ConditionFileIsExecutable=__INSTALL_DIR__/AdGuardHome After=syslog.target network-online.target [Service] @@ -9,8 +9,8 @@ User=__APP__ Group=__APP__ StartLimitInterval=5 StartLimitBurst=10 -WorkingDirectory=__FINALPATH__/ -ExecStart=__FINALPATH__/AdGuardHome +WorkingDirectory=__INSTALL_DIR__/ +ExecStart=__INSTALL_DIR__/AdGuardHome Restart=always RestartSec=10 #EnvironmentFile=-/etc/sysconfig/AdGuardHome diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..a962634 --- /dev/null +++ b/manifest.toml @@ -0,0 +1,70 @@ +packaging_format = 2 + +id = "adguardhome" +name = "AdGuard Home" +description.en = "Network-wide ads & trackers blocking DNS server" +description.fr = "Serveur DNS, bloqueur de publicités et trackers" + +version = "0.107.27~ynh1" + +maintainers = ["ddataa"] + +[upstream] +license = "GPL-3.0" +website = "https://adguard.com/adguard-home.html" +admindoc = "https://github.com/AdguardTeam/AdGuardHome/wiki" +userdoc = "https://kb.adguard.com/en" +code = "https://github.com/AdguardTeam/AdGuardHome" +cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number) +fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin. + +[integration] +yunohost = ">= 4.3.0" +architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] +multi_instance = false +ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials. +sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal. +disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... +ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... + +[install] + [install.domain] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "domain" + + [install.path] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "path" + default = "/adguard" + + [install.admin] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "user" + + [install.password] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "password" + + [install.dns_over_https] + ask.en = "Should DNS-over-HTTPS be enabled? (If so, anyone who knows your adguard address can make a doh request to https://adguardomain.tld/dns-query)" + type = "boolean" + default = true + +[resources] + [resources.sources.main] + in_subdir = false + arm64.url = "https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.27/AdGuardHome_linux_arm64.tar.gz" + arm64.sha256 = "d89d3a46fa0a6498f7a918fa7e0e25f92eaca11fb9829082ba9709ef9820bc3f" + amd64.url = "https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.27/AdGuardHome_linux_amd64.tar.gz" + amd64.sha256 = "98d06ff05e012475c9f3abe748cfb4b1f1244b78c1f1370c84cfba449e738183" + armhf.url = "https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.27/AdGuardHome_linux_armv7.tar.gz" + armhf.sha256 = "cb9fecbe03894b729b5092db823cbd54ea6883d5bbc46cb2c7de89b5d572ce39" + + + [resources.system_user] + + [resources.install_dir] + + [resources.permissions] + main.url = "/" diff --git a/scripts/_common.sh b/scripts/_common.sh index 11a54a8..cc89d5b 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= # dependencies used by the app -pkg_dependencies="python3-bcrypt python3-yaml" +#REMOVEME? pkg_dependencies="python3-bcrypt python3-yaml" #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index 27063e5..73dde61 100644 --- a/scripts/backup +++ b/scripts/backup @@ -14,21 +14,21 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { true } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." +#REMOVEME? ynh_print_info --message="Loading installation settings..." -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? 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) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -39,7 +39,7 @@ ynh_print_info --message="Declaring files to be backed up..." # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$final_path" +ynh_backup --src_path="$install_dir" #================================================= # BACKUP THE NGINX CONFIGURATION diff --git a/scripts/change_url b/scripts/change_url index eca2bc2..f699726 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -13,54 +13,54 @@ source /usr/share/yunohost/helpers # RETRIEVE ARGUMENTS #================================================= -old_domain=$YNH_APP_OLD_DOMAIN -old_path=$YNH_APP_OLD_PATH +#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN +#REMOVEME? old_path=$YNH_APP_OLD_PATH -new_domain=$YNH_APP_NEW_DOMAIN -new_path=$YNH_APP_NEW_PATH +#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN +#REMOVEME? new_path=$YNH_APP_NEW_PATH -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -# Needed for helper "ynh_add_nginx_config" -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? # Needed for helper "ynh_add_nginx_config" +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 +#REMOVEME? ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 # Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { +#REMOVEME? ynh_backup_before_upgrade +#REMOVEME? ynh_clean_setup () { # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. - ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" +#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" # Restore it if the upgrade fails - ynh_restore_upgradebackup +#REMOVEME? ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # CHECK WHICH PARTS SHOULD BE CHANGED #================================================= -change_domain=0 -if [ "$old_domain" != "$new_domain" ] +#REMOVEME? change_domain=0 +#REMOVEME? if [ "$old_domain" != "$new_domain" ] then - change_domain=1 + #REMOVEME? change_domain=1 fi -change_path=0 -if [ "$old_path" != "$new_path" ] +#REMOVEME? change_path=0 +#REMOVEME? if [ "$old_path" != "$new_path" ] then - change_path=1 + #REMOVEME? change_path=1 fi #================================================= @@ -77,28 +77,30 @@ ynh_systemd_action --service_name=$app --action="stop" #================================================= ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 -nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf +ynh_change_url_nginx_config + +#REMOVEME? nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf # Change the path in the NGINX config file if [ $change_path -eq 1 ] then # Make a backup of the original NGINX config file if modified - ynh_backup_if_checksum_is_different --file="$nginx_conf_path" +#REMOVEME? ynh_backup_if_checksum_is_different --file="$nginx_conf_path" # Set global variables for NGINX helper - domain="$old_domain" - path_url="$new_path" +#REMOVEME? domain="$old_domain" +#REMOVEME? path="$new_path" # Create a dedicated NGINX config - ynh_add_nginx_config +#REMOVEME? ynh_add_nginx_config fi # Change the domain for NGINX if [ $change_domain -eq 1 ] then # Delete file checksum for the old conf file location - ynh_delete_file_checksum --file="$nginx_conf_path" - mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf +#REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path" +#REMOVEME? mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf # Store file checksum for the new config file location - ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" +#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi #================================================= @@ -113,9 +115,9 @@ ynh_systemd_action --service_name=$app --action="start" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index 126161b..c17e7da 100644 --- a/scripts/install +++ b/scripts/install @@ -13,55 +13,55 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { ynh_clean_check_starting } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -domain=$YNH_APP_ARG_DOMAIN -path_url=$YNH_APP_ARG_PATH -admin=$YNH_APP_ARG_ADMIN -password=$YNH_APP_ARG_PASSWORD -dns_over_https=$YNH_APP_ARG_DNS_OVER_HTTPS +#REMOVEME? domain=$YNH_APP_ARG_DOMAIN +#REMOVEME? path=$YNH_APP_ARG_PATH +#REMOVEME? admin=$YNH_APP_ARG_ADMIN +#REMOVEME? password=$YNH_APP_ARG_PASSWORD +#REMOVEME? dns_over_https=$YNH_APP_ARG_DNS_OVER_HTTPS -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_script_progression --message="Validating installation parameters..." --weight=1 +#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1 -final_path=/var/www/$app -test ! -e "$final_path" || ynh_die --message="This path already contains a folder" +#REMOVEME? install_dir=/var/www/$app +#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder" # Register (book) web path -ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url +#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." --weight=2 +#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=2 -ynh_app_setting_set --app=$app --key=domain --value=$domain -ynh_app_setting_set --app=$app --key=path --value=$path_url -ynh_app_setting_set --app=$app --key=admin --value=$admin +#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain +#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path +#REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin if [ "$dns_over_https" == "1" ]; then dns_over_https="true" # DNS over TLS adguard_DoT_port=853 - ynh_app_setting_set --app=$app --key=adguard_DoT_port --value=$adguard_DoT_port +#REMOVEME? ynh_app_setting_set --app=$app --key=adguard_DoT_port --value=$adguard_DoT_port ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $adguard_DoT_port ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $adguard_DoT_port # DNS over QUIC adguard_DoQ_port=784 - ynh_app_setting_set --app=$app --key=adguard_DoQ_port --value=$adguard_DoQ_port +#REMOVEME? ynh_app_setting_set --app=$app --key=adguard_DoQ_port --value=$adguard_DoQ_port ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $adguard_DoQ_port else dns_over_https="false" @@ -73,15 +73,15 @@ ynh_app_setting_set --app=$app --key=dns_over_https --value=$dns_over_https #================================================= # FIND AND OPEN A PORT #================================================= -ynh_script_progression --message="Finding an available port..." --weight=1 +#REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=1 # Find an available port -port=$(ynh_find_port --port=3000) -ynh_app_setting_set --app=$app --key=port --value=$port +#REMOVEME? port=$(ynh_find_port --port=3000) +#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port # Find an available port adguard_port=53 -ynh_app_setting_set --app=$app --key=adguard_port --value=$adguard_port +#REMOVEME? ynh_app_setting_set --app=$app --key=adguard_port --value=$adguard_port # Disable the port 53 for upnp ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $adguard_port @@ -90,32 +90,32 @@ ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $adguard_port #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." --weight=1 +#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=1 -ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Configuring system user..." --weight=1 +#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=1 # Create a system user -ynh_system_user_create --username=$app --home_dir="$final_path" --groups="ssl-cert" +#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" --groups="ssl-cert" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=4 -ynh_app_setting_set --app=$app --key=final_path --value=$final_path +#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir=$final_path --source_id="$YNH_ARCH" +ynh_setup_source --dest_dir=$install_dir -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:$app "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:$app "$install_dir" -setcap 'CAP_NET_BIND_SERVICE=+eip CAP_NET_RAW=+eip' $final_path/AdGuardHome +setcap 'CAP_NET_BIND_SERVICE=+eip CAP_NET_RAW=+eip' $install_dir/AdGuardHome #================================================= # NGINX CONFIGURATION @@ -176,13 +176,13 @@ for i in $(seq "$(echo $ipv6_route_output | wc -w)" -1 1); do done password=$(python3 -c "import bcrypt; print(bcrypt.hashpw(b\"$password\", bcrypt.gensalt(rounds=10)).decode())") -ynh_app_setting_set --app=$app --key=password --value=$password +#REMOVEME? ynh_app_setting_set --app=$app --key=password --value=$password # Main config File -ynh_add_config --template="../conf/AdGuardHome.yaml" --destination="$final_path/AdGuardHome.yaml" +ynh_add_config --template="../conf/AdGuardHome.yaml" --destination="$install_dir/AdGuardHome.yaml" -chmod 600 "$final_path/AdGuardHome.yaml" -chown -R $app:$app "$final_path/AdGuardHome.yaml" +chmod 600 "$install_dir/AdGuardHome.yaml" +chown -R $app:$app "$install_dir/AdGuardHome.yaml" #================================================= # SETUP SYSTEMD @@ -212,16 +212,16 @@ ynh_systemd_action --service_name=$app --action="restart" --log_path=systemd #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring permissions..." +#REMOVEME? ynh_script_progression --message="Configuring permissions..." -ynh_permission_create --permission="api" --label="api" --url="re:$domain/dns-query" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true" +#REMOVEME? ynh_permission_create --permission="api" --label="api" --url="re:$domain/dns-query" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=2 +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=2 -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index 55b8349..628584e 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,14 +12,14 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -port=$(ynh_app_setting_get --app=$app --key=port) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -adguard_port=$(ynh_app_setting_get --app=$app --key=adguard_port) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? adguard_port=$(ynh_app_setting_get --app=$app --key=adguard_port) #================================================= # STANDARD REMOVE @@ -45,10 +45,10 @@ ynh_remove_systemd_config #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory..." --weight=1 +#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=1 # Remove the app directory securely -ynh_secure_remove --file="$final_path" +#REMOVEME? ynh_secure_remove --file="$install_dir" #================================================= # REMOVE NGINX CONFIGURATION @@ -61,10 +61,10 @@ ynh_remove_nginx_config #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_script_progression --message="Removing dependencies..." --weight=1 +#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=1 # Remove metapackage and its dependencies -ynh_remove_app_dependencies +#REMOVEME? ynh_remove_app_dependencies #================================================= # CLOSE A PORT @@ -79,10 +79,10 @@ fi #================================================= # REMOVE DEDICATED USER #================================================= -ynh_script_progression --message="Removing the dedicated system user..." --weight=1 +#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=1 # Delete a system user -ynh_system_user_delete --username=$app +#REMOVEME? ynh_system_user_delete --username=$app #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index 065e38d..c7986a2 100644 --- a/scripts/restore +++ b/scripts/restore @@ -14,55 +14,55 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { ynh_clean_check_starting } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -adguard_port=$(ynh_app_setting_get --app=$app --key=adguard_port) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? adguard_port=$(ynh_app_setting_get --app=$app --key=adguard_port) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_script_progression --message="Validating restoration parameters..." --weight=1 +#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1 -test ! -d $final_path \ - || ynh_die --message="There is already a directory: $final_path " +#REMOVEME? test ! -d $install_dir \ + || ynh_die --message="There is already a directory: $install_dir " #================================================= # STANDARD RESTORATION STEPS #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 +#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 # Create the dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir="$final_path" +#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" #================================================= # RESTORE THE APP MAIN DIR #================================================= ynh_script_progression --message="Restoring the app main directory..." --weight=1 -ynh_restore_file --origin_path="$final_path" +ynh_restore_file --origin_path="$install_dir" # this will be treated as a security issue. -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:$app "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:$app "$install_dir" -setcap 'CAP_NET_BIND_SERVICE=+eip CAP_NET_RAW=+eip' $final_path/AdGuardHome +setcap 'CAP_NET_BIND_SERVICE=+eip CAP_NET_RAW=+eip' $install_dir/AdGuardHome ynh_restore_file --origin_path="/etc/dnsmasq.d/$app" @@ -73,10 +73,10 @@ systemctl restart dnsmasq #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=1 +#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=1 # Define and install dependencies -ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_install_app_dependencies $pkg_dependencies #================================================= # RESTORE THE NGINX CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 0f075bb..c37101f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,18 +12,18 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -admin=$(ynh_app_setting_get --app=$app --key=admin) -password=$(ynh_app_setting_get --app=$app --key=password) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -port=$(ynh_app_setting_get --app=$app --key=port) -adguard_port=$(ynh_app_setting_get --app=$app --key=adguard_port) -dns_over_https=$(ynh_app_setting_get --app=$app --key=dns_over_https) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin) +#REMOVEME? password=$(ynh_app_setting_get --app=$app --key=password) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? adguard_port=$(ynh_app_setting_get --app=$app --key=adguard_port) +#REMOVEME? dns_over_https=$(ynh_app_setting_get --app=$app --key=dns_over_https) #================================================= # CHECK VERSION @@ -35,17 +35,17 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 +#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 # Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { +#REMOVEME? ynh_backup_before_upgrade +#REMOVEME? ynh_clean_setup () { ynh_clean_check_starting # Restore it if the upgrade fails - ynh_restore_upgradebackup +#REMOVEME? ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # STANDARD UPGRADE STEPS @@ -66,8 +66,8 @@ ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $adguard_port ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 # Cleaning legacy permissions -if ynh_legacy_permissions_exists; then - ynh_legacy_permissions_delete_all +#REMOVEME? if ynh_legacy_permissions_exists; then +#REMOVEME? ynh_legacy_permissions_delete_all ynh_app_setting_delete --app=$app --key=is_public fi @@ -75,12 +75,12 @@ fi # The dns port should be 53 if [ "$adguard_port" -ne "53" ]; then adguard_port=53 - ynh_app_setting_set --app=$app --key=adguard_port --value=$adguard_port +#REMOVEME? ynh_app_setting_set --app=$app --key=adguard_port --value=$adguard_port fi # Create a permission if needed -if ! ynh_permission_exists --permission="api"; then - ynh_permission_create --permission="api" --label="api" --url="re:$domain/dns-query" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true" +#REMOVEME? if ! ynh_permission_exists --permission="api"; then +#REMOVEME? ynh_permission_create --permission="api" --label="api" --url="re:$domain/dns-query" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true" fi if [ -n "$dns_over_https" ] && [ "$dns_over_https" == "1" ]; @@ -89,12 +89,12 @@ then ynh_app_setting_set --app=$app --key=dns_over_https --value=$dns_over_https # DNS over TLS adguard_DoT_port=853 - ynh_app_setting_set --app=$app --key=adguard_DoT_port --value=$adguard_DoT_port +#REMOVEME? ynh_app_setting_set --app=$app --key=adguard_DoT_port --value=$adguard_DoT_port ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $adguard_DoT_port ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $adguard_DoT_port # DNS over QUIC adguard_DoQ_port=784 - ynh_app_setting_set --app=$app --key=adguard_DoQ_port --value=$adguard_DoQ_port +#REMOVEME? ynh_app_setting_set --app=$app --key=adguard_DoQ_port --value=$adguard_DoQ_port ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $adguard_DoQ_port elif [ -z "$dns_over_https" ] || [ "$dns_over_https" == "0" ]; then @@ -105,10 +105,10 @@ fi #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 +#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 # Create a dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir="$final_path" --groups="ssl-cert" +#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" --groups="ssl-cert" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -119,21 +119,21 @@ then ynh_script_progression --message="Upgrading source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir=$final_path --source_id="$YNH_ARCH" + ynh_setup_source --dest_dir=$install_dir fi -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:$app "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:$app "$install_dir" -setcap 'CAP_NET_BIND_SERVICE=+eip CAP_NET_RAW=+eip' $final_path/AdGuardHome +setcap 'CAP_NET_BIND_SERVICE=+eip CAP_NET_RAW=+eip' $install_dir/AdGuardHome #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=1 +#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=1 -ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_install_app_dependencies $pkg_dependencies #================================================= # NGINX CONFIGURATION @@ -194,7 +194,7 @@ done # Reset the bind_hosts if the current ip is 0.0.0.0 python3 -c "import yaml -with open(\"$final_path/AdGuardHome.yaml\", 'r') as file: +with open(\"$install_dir/AdGuardHome.yaml\", 'r') as file: conf_file = yaml.safe_load(file) need_file_update = False @@ -212,12 +212,12 @@ if conf_file[\"dns\"][\"port\"] != $adguard_port: need_file_update = True if need_file_update: - with open(\"$final_path/AdGuardHome.yaml\", 'w') as file: + with open(\"$install_dir/AdGuardHome.yaml\", 'w') as file: yaml.dump(conf_file, file) " -chmod 600 "$final_path/AdGuardHome.yaml" -chown -R $app:$app "$final_path/AdGuardHome.yaml" +chmod 600 "$install_dir/AdGuardHome.yaml" +chown -R $app:$app "$install_dir/AdGuardHome.yaml" #================================================= # SETUP SYSTEMD @@ -244,9 +244,9 @@ ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT From 23170eb150e01404db022f170dd42da8c6b3c3ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 6 Apr 2023 09:27:41 +0200 Subject: [PATCH 02/13] v2 --- .github/workflows/updater.sh | 136 --------------------------- .github/workflows/updater.yml | 49 ---------- conf/AdGuardHome.yaml | 2 +- conf/systemd.service | 2 +- doc/DISCLAIMER_fr.md | 0 manifest.toml | 36 ++++--- scripts/_common.sh | 3 - scripts/actions/reset_default_config | 6 +- scripts/backup | 20 ---- scripts/change_url | 85 ----------------- scripts/install | 79 ++-------------- scripts/remove | 46 --------- scripts/restore | 52 +--------- scripts/upgrade | 76 +-------------- doc/DISCLAIMER.md => tests.toml | 0 15 files changed, 39 insertions(+), 553 deletions(-) delete mode 100755 .github/workflows/updater.sh delete mode 100644 .github/workflows/updater.yml delete mode 100644 doc/DISCLAIMER_fr.md rename doc/DISCLAIMER.md => tests.toml (100%) diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh deleted file mode 100755 index 84c5a51..0000000 --- a/.github/workflows/updater.sh +++ /dev/null @@ -1,136 +0,0 @@ -#!/bin/bash - -#================================================= -# PACKAGE UPDATING HELPER -#================================================= - -# This script is meant to be run by GitHub Actions -# The YunoHost-Apps organisation offers a template Action to run this script periodically -# Since each app is different, maintainers can adapt its contents so as to perform -# automatic actions when a new upstream release is detected. - -#================================================= -# FETCHING LATEST RELEASE AND ITS ASSETS -#================================================= - -# Fetching information -current_version=$(cat manifest.json | jq -j '.version|split("~")[0]') -repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]') -# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions) -version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1) -assets=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[ .[] | select(.tag_name=="'$version'").assets[].browser_download_url ] | join(" ") | @sh' | tr -d "'")) - -# Later down the script, we assume the version has only digits and dots -# Sometimes the release name starts with a "v", so let's filter it out. -# You may need more tweaks here if the upstream repository has different naming conventions. -if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then - version=${version:1} -fi - -# Setting up the environment variables -echo "Current version: $current_version" -echo "Latest release from upstream: $version" -echo "VERSION=$version" >> $GITHUB_ENV -# For the time being, let's assume the script will fail -echo "PROCEED=false" >> $GITHUB_ENV - -# Proceed only if the retrieved version is greater than the current one -if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then - echo "::warning ::No new version available" - exit 0 -# Proceed only if a PR for this new version does not already exist -elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then - echo "::warning ::A branch already exists for this update" - exit 0 -fi - -# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.) -echo "${#assets[@]} available asset(s)" - -#================================================= -# UPDATE SOURCE FILES -#================================================= - -# Here we use the $assets variable to get the resources published in the upstream release. -# Here is an example for Grav, it has to be adapted in accordance with how the upstream releases look like. - -# Let's loop over the array of assets URLs -for asset_url in "${assets[@]}"; do - -echo "Handling asset at $asset_url" - -# Assign the asset to a source file in conf/ directory -# Here we base the source file name upon a unique keyword in the assets url (admin vs. update) -# Leave $src empty to ignore the asset -case $asset_url in - *"AdGuardHome_linux_amd64.tar.gz") - src="amd64" - ;; - *"AdGuardHome_linux_armv7.tar.gz") - src="armhf" - ;; - *"AdGuardHome_linux_arm64.tar.gz") - src="arm64" - ;; - *) - src="" - ;; -esac - -# If $src is not empty, let's process the asset -if [ ! -z "$src" ]; then - -# Create the temporary directory -tempdir="$(mktemp -d)" - -# Download sources and calculate checksum -filename=${asset_url##*/} -curl --silent -4 -L $asset_url -o "$tempdir/$filename" -checksum=$(sha256sum "$tempdir/$filename" | head -c 64) - -# Delete temporary directory -rm -rf $tempdir - -# Get extension -if [[ $filename == *.tar.gz ]]; then - extension=tar.gz -else - extension=${filename##*.} -fi - -# Rewrite source file -cat < conf/$src.src -SOURCE_URL=$asset_url -SOURCE_SUM=$checksum -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=2 -SOURCE_EXTRACT=true -EOT -echo "... conf/$src.src updated" - -else -echo "... asset ignored" -fi - -done - -#================================================= -# SPECIFIC UPDATE STEPS -#================================================= - -# Any action on the app's source code can be done. -# The GitHub Action workflow takes care of committing all changes after this script ends. - -#================================================= -# GENERIC FINALIZATION -#================================================= - -# Replace new version in manifest -echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json - -# No need to update the README, yunohost-bot takes care of it - -# The Action will proceed only if the PROCEED environment variable is set to true -echo "PROCEED=true" >> $GITHUB_ENV -exit 0 diff --git a/.github/workflows/updater.yml b/.github/workflows/updater.yml deleted file mode 100644 index a56d7cb..0000000 --- a/.github/workflows/updater.yml +++ /dev/null @@ -1,49 +0,0 @@ -# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected. -# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization. -# This file should be enough by itself, but feel free to tune it to your needs. -# It calls updater.sh, which is where you should put the app-specific update steps. -name: Check for new upstream releases -on: - # Allow to manually trigger the workflow - workflow_dispatch: - # Run it every day at 6:00 UTC - schedule: - - cron: '0 6 * * *' -jobs: - updater: - runs-on: ubuntu-latest - steps: - - name: Fetch the source code - uses: actions/checkout@v3 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - name: Run the updater script - id: run_updater - run: | - # Setting up Git user - git config --global user.name 'yunohost-bot' - git config --global user.email 'yunohost-bot@users.noreply.github.com' - # Run the updater script - /bin/bash .github/workflows/updater.sh - - name: Commit changes - id: commit - if: ${{ env.PROCEED == 'true' }} - run: | - git commit -am "Upgrade to v$VERSION" - - name: Create Pull Request - id: cpr - if: ${{ env.PROCEED == 'true' }} - uses: peter-evans/create-pull-request@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - commit-message: Update to version ${{ env.VERSION }} - committer: 'yunohost-bot ' - author: 'yunohost-bot ' - signoff: false - base: testing - branch: ci-auto-update-v${{ env.VERSION }} - delete-branch: true - title: 'Upgrade to version ${{ env.VERSION }}' - body: | - Upgrade to v${{ env.VERSION }} - draft: false diff --git a/conf/AdGuardHome.yaml b/conf/AdGuardHome.yaml index d0d4c6e..588e664 100644 --- a/conf/AdGuardHome.yaml +++ b/conf/AdGuardHome.yaml @@ -15,7 +15,7 @@ dns: bind_hosts: __IPV4_ADDR__ __IPV6_ADDR__ - port: __ADGUARD_PORT__ + port: __PORT_ADGUARD__ statistics_interval: 1 querylog_enabled: true querylog_file_enabled: true diff --git a/conf/systemd.service b/conf/systemd.service index 2adca30..7705193 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -1,5 +1,5 @@ [Unit] -Description=AdGuard Home: Network-level blocker +Description=AdGuardHome: Network-level blocker ConditionFileIsExecutable=__INSTALL_DIR__/AdGuardHome After=syslog.target network-online.target diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md deleted file mode 100644 index e69de29..0000000 diff --git a/manifest.toml b/manifest.toml index a962634..bdfe369 100644 --- a/manifest.toml +++ b/manifest.toml @@ -15,35 +15,29 @@ website = "https://adguard.com/adguard-home.html" admindoc = "https://github.com/AdguardTeam/AdGuardHome/wiki" userdoc = "https://kb.adguard.com/en" code = "https://github.com/AdguardTeam/AdGuardHome" -cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number) -fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin. [integration] -yunohost = ">= 4.3.0" -architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] +yunohost = ">= 11.1.17" +architectures = "all" multi_instance = false -ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials. -sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal. -disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... -ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... -ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +ldap = false +sso = false +disk = "50M" +ram.build = "50M" +ram.runtime = "50M" [install] [install.domain] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "domain" [install.path] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "path" default = "/adguard" [install.admin] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "user" [install.password] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "password" [install.dns_over_https] @@ -61,6 +55,14 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen armhf.url = "https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.27/AdGuardHome_linux_armv7.tar.gz" armhf.sha256 = "cb9fecbe03894b729b5092db823cbd54ea6883d5bbc46cb2c7de89b5d572ce39" + autoupdate.strategy = "latest_github_release" + autoupdate.asset.amd64 = "^AdGuardHome_linux_amd64.tar.gz$" + autoupdate.asset.arm64 = "^AdGuardHome_linux_arm64.tar.gz$" + autoupdate.asset.armhf = "^AdGuardHome_linux_armv7.tar.gz$" + + [resources.ports] + adguard.default = 53 + adguard.exposed = "Both" [resources.system_user] @@ -68,3 +70,11 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen [resources.permissions] main.url = "/" + api.url = "/re:__DOMAIN__/dns-query" + api.allowed = "visitors" + api.auth_header = false + api.show_tile = false + api.protected = true + + [resources.apt] + packages ="python3-bcrypt python3-yaml" diff --git a/scripts/_common.sh b/scripts/_common.sh index cc89d5b..944a65e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,9 +4,6 @@ # COMMON VARIABLES #================================================= -# dependencies used by the app -#REMOVEME? pkg_dependencies="python3-bcrypt python3-yaml" - #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/actions/reset_default_config b/scripts/actions/reset_default_config index c8d6bff..45109c7 100644 --- a/scripts/actions/reset_default_config +++ b/scripts/actions/reset_default_config @@ -24,9 +24,9 @@ app=$YNH_APP_INSTANCE_NAME admin=$(ynh_app_setting_get --app=$app --key=admin) password=$(ynh_app_setting_get --app=$app --key=password) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) +install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) port=$(ynh_app_setting_get --app=$app --key=port) -adguard_port=$(ynh_app_setting_get --app=$app --key=adguard_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) @@ -55,7 +55,7 @@ done #================================================= ynh_script_progression --message="Updating a configuration file..." --weight=1 -ynh_add_config --template="../conf/AdGuardHome.yaml" --destination="$final_path/AdGuardHome.yaml" +ynh_add_config --template="../conf/AdGuardHome.yaml" --destination="$install_dir/AdGuardHome.yaml" #================================================= # RESTART SYSTEMD SERVICE diff --git a/scripts/backup b/scripts/backup index 73dde61..250b80f 100644 --- a/scripts/backup +++ b/scripts/backup @@ -10,26 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - true -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_print_info --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= diff --git a/scripts/change_url b/scripts/change_url index f699726..fcf7c7e 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,60 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN -#REMOVEME? old_path=$YNH_APP_OLD_PATH - -#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN -#REMOVEME? new_path=$YNH_APP_NEW_PATH - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? # Needed for helper "ynh_add_nginx_config" -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) - -#================================================= -# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP -#================================================= -#REMOVEME? ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. -#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" - - # Restore it if the upgrade fails -#REMOVEME? ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# CHECK WHICH PARTS SHOULD BE CHANGED -#================================================= - -#REMOVEME? change_domain=0 -#REMOVEME? if [ "$old_domain" != "$new_domain" ] -then - #REMOVEME? change_domain=1 -fi - -#REMOVEME? change_path=0 -#REMOVEME? if [ "$old_path" != "$new_path" ] -then - #REMOVEME? change_path=1 -fi - #================================================= # STANDARD MODIFICATIONS #================================================= @@ -79,30 +25,6 @@ ynh_script_progression --message="Updating NGINX web server configuration..." -- ynh_change_url_nginx_config -#REMOVEME? nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf - -# Change the path in the NGINX config file -if [ $change_path -eq 1 ] -then - # Make a backup of the original NGINX config file if modified -#REMOVEME? ynh_backup_if_checksum_is_different --file="$nginx_conf_path" - # Set global variables for NGINX helper -#REMOVEME? domain="$old_domain" -#REMOVEME? path="$new_path" - # Create a dedicated NGINX config -#REMOVEME? ynh_add_nginx_config -fi - -# Change the domain for NGINX -if [ $change_domain -eq 1 ] -then - # Delete file checksum for the old conf file location -#REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path" -#REMOVEME? mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf - # Store file checksum for the new config file location -#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" -fi - #================================================= # GENERIC FINALISATION #================================================= @@ -112,13 +34,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index c17e7da..f3dc0ee 100644 --- a/scripts/install +++ b/scripts/install @@ -9,59 +9,22 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# RETRIEVE ARGUMENTS FROM THE MANIFEST -#================================================= - -#REMOVEME? domain=$YNH_APP_ARG_DOMAIN -#REMOVEME? path=$YNH_APP_ARG_PATH -#REMOVEME? admin=$YNH_APP_ARG_ADMIN -#REMOVEME? password=$YNH_APP_ARG_PASSWORD -#REMOVEME? dns_over_https=$YNH_APP_ARG_DNS_OVER_HTTPS - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1 - -#REMOVEME? install_dir=/var/www/$app -#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder" - -# Register (book) web path -#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path - #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=2 - -#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain -#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path -#REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin +ynh_script_progression --message="Storing installation settings..." --weight=2 if [ "$dns_over_https" == "1" ]; then dns_over_https="true" # DNS over TLS adguard_DoT_port=853 -#REMOVEME? ynh_app_setting_set --app=$app --key=adguard_DoT_port --value=$adguard_DoT_port + ynh_app_setting_set --app=$app --key=adguard_DoT_port --value=$adguard_DoT_port ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $adguard_DoT_port ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $adguard_DoT_port # DNS over QUIC adguard_DoQ_port=784 -#REMOVEME? ynh_app_setting_set --app=$app --key=adguard_DoQ_port --value=$adguard_DoQ_port + ynh_app_setting_set --app=$app --key=adguard_DoQ_port --value=$adguard_DoQ_port ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $adguard_DoQ_port else dns_over_https="false" @@ -76,23 +39,12 @@ ynh_app_setting_set --app=$app --key=dns_over_https --value=$dns_over_https #REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=1 # Find an available port -#REMOVEME? port=$(ynh_find_port --port=3000) -#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port - -# Find an available port -adguard_port=53 +#REMOVEME? adguard_port=53 #REMOVEME? ynh_app_setting_set --app=$app --key=adguard_port --value=$adguard_port # Disable the port 53 for upnp -ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $adguard_port -ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $adguard_port - -#================================================= -# INSTALL DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=1 - -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $adguard_port +#REMOVEME? ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $adguard_port #================================================= # CREATE DEDICATED USER @@ -107,7 +59,6 @@ ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $adguard_port #================================================= ynh_script_progression --message="Setting up source files..." --weight=4 -#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir=$install_dir @@ -176,7 +127,7 @@ for i in $(seq "$(echo $ipv6_route_output | wc -w)" -1 1); do done password=$(python3 -c "import bcrypt; print(bcrypt.hashpw(b\"$password\", bcrypt.gensalt(rounds=10)).decode())") -#REMOVEME? ynh_app_setting_set --app=$app --key=password --value=$password +ynh_app_setting_set --app=$app --key=password --value=$password # Main config File ynh_add_config --template="../conf/AdGuardHome.yaml" --destination="$install_dir/AdGuardHome.yaml" @@ -199,7 +150,7 @@ ynh_add_systemd_config #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add $app --description="Ads & trackers blocking DNS server" --needs_exposed_ports $adguard_port +yunohost service add $app --description="Ads & trackers blocking DNS server" --needs_exposed_ports $port_adguard #================================================= # START SYSTEMD SERVICE @@ -209,20 +160,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=2 # Start a systemd service ynh_systemd_action --service_name=$app --action="restart" --log_path=systemd -#================================================= -# SETUP SSOWAT -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring permissions..." - -#REMOVEME? ynh_permission_create --permission="api" --label="api" --url="re:$domain/dns-query" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true" - -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=2 - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index 628584e..06fb827 100644 --- a/scripts/remove +++ b/scripts/remove @@ -9,18 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? adguard_port=$(ynh_app_setting_get --app=$app --key=adguard_port) - #================================================= # STANDARD REMOVE #================================================= @@ -42,14 +30,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..." # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE APP MAIN DIR -#================================================= -#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=1 - -# Remove the app directory securely -#REMOVEME? ynh_secure_remove --file="$install_dir" - #================================================= # REMOVE NGINX CONFIGURATION #================================================= @@ -58,32 +38,6 @@ ynh_script_progression --message="Removing NGINX web server configuration..." -- # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# REMOVE DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=1 - -# Remove metapackage and its dependencies -#REMOVEME? ynh_remove_app_dependencies - -#================================================= -# CLOSE A PORT -#================================================= - -if yunohost firewall list | grep -q "\- $adguard_port$" -then - ynh_script_progression --message="Closing port $adguard_port..." --weight=1 - ynh_exec_warn_less yunohost firewall disallow TCP $adguard_port -fi - -#================================================= -# REMOVE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=1 - -# Delete a system user -#REMOVEME? ynh_system_user_delete --username=$app - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index c7986a2..f75d0da 100644 --- a/scripts/restore +++ b/scripts/restore @@ -10,46 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? adguard_port=$(ynh_app_setting_get --app=$app --key=adguard_port) - -#================================================= -# CHECK IF THE APP CAN BE RESTORED -#================================================= -#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1 - -#REMOVEME? test ! -d $install_dir \ - || ynh_die --message="There is already a directory: $install_dir " - -#================================================= -# STANDARD RESTORATION STEPS -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 - -# Create the dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" - #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -68,16 +28,6 @@ ynh_restore_file --origin_path="/etc/dnsmasq.d/$app" systemctl restart dnsmasq -#================================================= -# SPECIFIC RESTORATION -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=1 - -# Define and install dependencies -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies - #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= @@ -98,7 +48,7 @@ systemctl enable $app.service --quiet #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add $app --description="Ads & trackers blocking DNS server" --needs_exposed_ports $adguard_port +yunohost service add $app --description="Ads & trackers blocking DNS server" --needs_exposed_ports $port_adguard #================================================= # START SYSTEMD SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index c37101f..eac6d56 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,44 +9,12 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin) -#REMOVEME? password=$(ynh_app_setting_get --app=$app --key=password) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) -#REMOVEME? adguard_port=$(ynh_app_setting_get --app=$app --key=adguard_port) -#REMOVEME? dns_over_https=$(ynh_app_setting_get --app=$app --key=dns_over_https) - #================================================= # CHECK VERSION #================================================= -ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - ynh_clean_check_starting - # Restore it if the upgrade fails -#REMOVEME? ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -65,36 +33,18 @@ ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $adguard_port #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 -# Cleaning legacy permissions -#REMOVEME? if ynh_legacy_permissions_exists; then -#REMOVEME? ynh_legacy_permissions_delete_all - - ynh_app_setting_delete --app=$app --key=is_public -fi - -# The dns port should be 53 -if [ "$adguard_port" -ne "53" ]; then - adguard_port=53 -#REMOVEME? ynh_app_setting_set --app=$app --key=adguard_port --value=$adguard_port -fi - -# Create a permission if needed -#REMOVEME? if ! ynh_permission_exists --permission="api"; then -#REMOVEME? ynh_permission_create --permission="api" --label="api" --url="re:$domain/dns-query" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true" -fi - if [ -n "$dns_over_https" ] && [ "$dns_over_https" == "1" ]; then dns_over_https="true" ynh_app_setting_set --app=$app --key=dns_over_https --value=$dns_over_https # DNS over TLS adguard_DoT_port=853 -#REMOVEME? ynh_app_setting_set --app=$app --key=adguard_DoT_port --value=$adguard_DoT_port + ynh_app_setting_set --app=$app --key=adguard_DoT_port --value=$adguard_DoT_port ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $adguard_DoT_port ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $adguard_DoT_port # DNS over QUIC adguard_DoQ_port=784 -#REMOVEME? ynh_app_setting_set --app=$app --key=adguard_DoQ_port --value=$adguard_DoQ_port + ynh_app_setting_set --app=$app --key=adguard_DoQ_port --value=$adguard_DoQ_port ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $adguard_DoQ_port elif [ -z "$dns_over_https" ] || [ "$dns_over_https" == "0" ]; then @@ -102,14 +52,6 @@ then ynh_app_setting_set --app=$app --key=dns_over_https --value=$dns_over_https fi -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 - -# Create a dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" --groups="ssl-cert" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -128,13 +70,6 @@ chown -R $app:$app "$install_dir" setcap 'CAP_NET_BIND_SERVICE=+eip CAP_NET_RAW=+eip' $install_dir/AdGuardHome -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=1 - -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies - #================================================= # NGINX CONFIGURATION #================================================= @@ -241,13 +176,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd" -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/doc/DISCLAIMER.md b/tests.toml similarity index 100% rename from doc/DISCLAIMER.md rename to tests.toml From 013bb68cb4ec1b6166f36d59224856525049197f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 27 Sep 2023 15:02:25 +0200 Subject: [PATCH 03/13] cleaning --- config_panel.toml | 6 ++--- manifest.json | 60 ---------------------------------------------- manifest.toml | 8 +++++-- scripts/change_url | 4 ++-- scripts/install | 16 ------------- scripts/remove | 10 -------- scripts/restore | 17 ------------- scripts/upgrade | 25 ++++--------------- tests.toml | 9 +++++++ 9 files changed, 25 insertions(+), 130 deletions(-) delete mode 100644 manifest.json diff --git a/config_panel.toml b/config_panel.toml index f57cd51..f2aee75 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -1,7 +1,8 @@ version = "1.0" [main] -name = "Adguard configuration" +name = "AdguardHome configuration" +services = ["__APP__"] [main.options] name = "Enable some features" @@ -11,5 +12,4 @@ name = "Adguard configuration" type = "boolean" yes = "true" no = "false" - bind = "allow_unencrypted_doh:__FINALPATH__/AdGuardHome.yaml" - services = [ '__APP__' ] \ No newline at end of file + bind = "allow_unencrypted_doh:__INSTALL_DIR__/AdGuardHome.yaml" diff --git a/manifest.json b/manifest.json deleted file mode 100644 index e05c378..0000000 --- a/manifest.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "AdGuard Home", - "id": "adguardhome", - "packaging_format": 1, - "description": { - "en": "Network-wide ads & trackers blocking DNS server", - "fr": "Serveur DNS, bloqueur de publicités et trackers" - }, - "version": "0.107.27~ynh1", - "url": "https://adguard.com/adguard-home.html", - "upstream": { - "license": "GPL-3.0", - "website": "https://adguard.com/adguard-home.html", - "admindoc": "https://github.com/AdguardTeam/AdGuardHome/wiki", - "userdoc": "https://kb.adguard.com/en", - "code": "https://github.com/AdguardTeam/AdGuardHome", - "cpe": "cpe:2.3:a:adguard:adguardhome" - }, - "license": "GPL-3.0", - "maintainer": { - "name": "ddataa", - "email": "" - }, - "requirements": { - "yunohost": ">= 4.3.0" - }, - "multi_instance": false, - "services": [ - "nginx" - ], - "arguments": { - "install": [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "path", - "type": "path", - "default": "/adguard" - }, - { - "name": "admin", - "type": "user" - }, - { - "name": "password", - "type": "password" - }, - { - "name": "dns_over_https", - "type": "boolean", - "ask": { - "en": "Should DNS-over-HTTPS be enabled? (If so, anyone who knows your adguard address can make a doh request to https://adguardomain.tld/dns-query)" - }, - "default": true - } - ] - } -} diff --git a/manifest.toml b/manifest.toml index bdfe369..d8fc795 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,7 +17,7 @@ userdoc = "https://kb.adguard.com/en" code = "https://github.com/AdguardTeam/AdGuardHome" [integration] -yunohost = ">= 11.1.17" +yunohost = ">= 11.2" architectures = "all" multi_instance = false ldap = false @@ -34,6 +34,10 @@ ram.runtime = "50M" type = "path" default = "/adguard" + [install.init_main_permission] + type = "group" + default = "visitors" + [install.admin] type = "user" @@ -77,4 +81,4 @@ ram.runtime = "50M" api.protected = true [resources.apt] - packages ="python3-bcrypt python3-yaml" + packages ="python3-bcrypt, python3-yaml" diff --git a/scripts/change_url b/scripts/change_url index fcf7c7e..5c25374 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -16,7 +16,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="stop" +ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= # MODIFY URL IN NGINX CONF @@ -32,7 +32,7 @@ ynh_change_url_nginx_config #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index f3dc0ee..5bc9efd 100644 --- a/scripts/install +++ b/scripts/install @@ -31,21 +31,6 @@ else fi ynh_app_setting_set --app=$app --key=dns_over_https --value=$dns_over_https -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# FIND AND OPEN A PORT -#================================================= -#REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=1 - -# Find an available port -#REMOVEME? adguard_port=53 -#REMOVEME? ynh_app_setting_set --app=$app --key=adguard_port --value=$adguard_port - -# Disable the port 53 for upnp -#REMOVEME? ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $adguard_port -#REMOVEME? ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $adguard_port - #================================================= # CREATE DEDICATED USER #================================================= @@ -62,7 +47,6 @@ ynh_script_progression --message="Setting up source files..." --weight=4 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir=$install_dir -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:$app "$install_dir" diff --git a/scripts/remove b/scripts/remove index 06fb827..57324bf 100644 --- a/scripts/remove +++ b/scripts/remove @@ -22,19 +22,9 @@ then yunohost service remove $app fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 - # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 - # Remove the dedicated NGINX config ynh_remove_nginx_config diff --git a/scripts/restore b/scripts/restore index f75d0da..60a2b03 100644 --- a/scripts/restore +++ b/scripts/restore @@ -35,19 +35,9 @@ ynh_script_progression --message="Restoring the NGINX web server configuration.. ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# 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 -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - yunohost service add $app --description="Ads & trackers blocking DNS server" --needs_exposed_ports $port_adguard #================================================= @@ -57,13 +47,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd" -#================================================= -# GENERIC FINALIZATION -#================================================= -# RELOAD NGINX AND PHP-FPM -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index eac6d56..72cdcbd 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,10 +24,6 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="stop" -# Disable the port 53 for upnp -ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $adguard_port -ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $adguard_port - #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -64,7 +60,6 @@ then ynh_setup_source --dest_dir=$install_dir fi -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:$app "$install_dir" @@ -78,6 +73,11 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated NGINX config ynh_add_nginx_config +# Create a dedicated systemd config +ynh_add_systemd_config + +yunohost service add $app --description="Ads & trackers blocking DNS server" --needs_exposed_ports $adguard_port + #================================================= # SPECIFIC UPGRADE #================================================= @@ -154,21 +154,6 @@ if need_file_update: chmod 600 "$install_dir/AdGuardHome.yaml" chown -R $app:$app "$install_dir/AdGuardHome.yaml" -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 - -# Create a dedicated systemd config -ynh_add_systemd_config - -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - -yunohost service add $app --description="Ads & trackers blocking DNS server" --needs_exposed_ports $adguard_port - #================================================= # START SYSTEMD SERVICE #================================================= diff --git a/tests.toml b/tests.toml index e69de29..00d7469 100644 --- a/tests.toml +++ b/tests.toml @@ -0,0 +1,9 @@ +test_format = 1.0 + +[default] + + # ------------------------------- + # Default args to use for install + # ------------------------------- + + args.dns_over_https=1 \ No newline at end of file From dedcedd80c608f6a531ff7bf1ca560fee0f061e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 27 Sep 2023 15:05:19 +0200 Subject: [PATCH 04/13] Update upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 72cdcbd..79c845d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -76,7 +76,7 @@ ynh_add_nginx_config # Create a dedicated systemd config ynh_add_systemd_config -yunohost service add $app --description="Ads & trackers blocking DNS server" --needs_exposed_ports $adguard_port +yunohost service add $app --description="Ads & trackers blocking DNS server" --needs_exposed_ports $port_adguard #================================================= # SPECIFIC UPGRADE From a2d0224a0c367fe07fae78c346a75b52deca66df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 27 Sep 2023 15:07:09 +0200 Subject: [PATCH 05/13] Update install --- scripts/install | 7 ------- 1 file changed, 7 deletions(-) diff --git a/scripts/install b/scripts/install index 5bc9efd..35ab3dc 100644 --- a/scripts/install +++ b/scripts/install @@ -127,13 +127,6 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=1 # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# GENERIC FINALIZATION -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - yunohost service add $app --description="Ads & trackers blocking DNS server" --needs_exposed_ports $port_adguard #================================================= From bf7671f454f8d4b683069188e5317f841d92c2b8 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Wed, 18 Oct 2023 21:28:05 +0000 Subject: [PATCH 06/13] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 223f82b..558cdfb 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ AdGuard Home is a network-wide software for blocking ads & tracking. After you s It operates as a DNS server that re-routes tracking domains to a "black hole", thus preventing your devices from connecting to those servers. It's based on software we use for our public AdGuard DNS servers -- both share a lot of common code. -**Shipped version:** 0.107.40~ynh1 +**Shipped version:** 0.107.27~ynh1 ## Screenshots diff --git a/README_fr.md b/README_fr.md index 0b281cb..ff2768f 100644 --- a/README_fr.md +++ b/README_fr.md @@ -21,7 +21,7 @@ AdGuard Home est un logiciel à l'échelle du réseau pour bloquer les publicit Il fonctionne comme un serveur DNS qui redirige les domaines de pistage vers un "trou noir", empêchant ainsi vos appareils de se connecter à ces serveurs. Il est basé sur un logiciel que nous utilisons pour nos serveurs DNS publics AdGuard - les deux partagent beaucoup de code commun. -**Version incluse :** 0.107.40~ynh1 +**Version incluse :** 0.107.27~ynh1 ## Captures d’écran From 67527e481777bb079302ff0c1771e7da7ee93193 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sun, 3 Dec 2023 00:03:55 +0100 Subject: [PATCH 07/13] actions.toml have been obsolete for like 2 years now, this code is not used anywhere --- actions.toml | 8 ---- scripts/actions/reset_default_config | 65 ---------------------------- 2 files changed, 73 deletions(-) delete mode 100644 actions.toml delete mode 100644 scripts/actions/reset_default_config 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" From bbbaef59aa141cffbd128bcb03bac67fd0d8fb6b Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sat, 2 Dec 2023 23:04:21 +0000 Subject: [PATCH 08/13] Auto-update README --- README.md | 1 + README_fr.md | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index 558cdfb..e3679c1 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ It operates as a DNS server that re-routes tracking domains to a "black hole", t * Official user documentation: * Official admin documentation: * Upstream app code repository: +* YunoHost Store: * Report a bug: ## Developer info diff --git a/README_fr.md b/README_fr.md index ff2768f..6de1685 100644 --- a/README_fr.md +++ b/README_fr.md @@ -33,6 +33,7 @@ Il fonctionne comme un serveur DNS qui redirige les domaines de pistage vers un * Documentation officielle utilisateur : * Documentation officielle de l’admin : * Dépôt de code officiel de l’app : +* YunoHost Store: * Signaler un bug : ## Informations pour les développeurs From 060e11f7aaefa0502e00c12add452368035ab882 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sun, 3 Dec 2023 00:06:09 +0100 Subject: [PATCH 09/13] Remove old system user creation code --- scripts/install | 8 -------- 1 file changed, 8 deletions(-) diff --git a/scripts/install b/scripts/install index 08fc4c1..5c2e176 100644 --- a/scripts/install +++ b/scripts/install @@ -31,14 +31,6 @@ else fi ynh_app_setting_set --app="$app" --key=dns_over_https --value=$dns_over_https -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=1 - -# Create a system user -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" --groups="ssl-cert" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= From 53c0bf250a899a8dde36e80f343432b654b89c81 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sun, 3 Dec 2023 00:11:59 +0100 Subject: [PATCH 10/13] manifest: update to 0.107.41 --- manifest.toml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/manifest.toml b/manifest.toml index d8fc795..752e75e 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "AdGuard Home" description.en = "Network-wide ads & trackers blocking DNS server" description.fr = "Serveur DNS, bloqueur de publicités et trackers" -version = "0.107.27~ynh1" +version = "0.107.41~ynh1" maintainers = ["ddataa"] @@ -52,12 +52,12 @@ ram.runtime = "50M" [resources] [resources.sources.main] in_subdir = false - arm64.url = "https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.27/AdGuardHome_linux_arm64.tar.gz" - arm64.sha256 = "d89d3a46fa0a6498f7a918fa7e0e25f92eaca11fb9829082ba9709ef9820bc3f" - amd64.url = "https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.27/AdGuardHome_linux_amd64.tar.gz" - amd64.sha256 = "98d06ff05e012475c9f3abe748cfb4b1f1244b78c1f1370c84cfba449e738183" - armhf.url = "https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.27/AdGuardHome_linux_armv7.tar.gz" - armhf.sha256 = "cb9fecbe03894b729b5092db823cbd54ea6883d5bbc46cb2c7de89b5d572ce39" + arm64.url = "https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.41/AdGuardHome_linux_arm64.tar.gz" + arm64.sha256 = "e23f5164a832c8647e0035b03189dc9c72821e9216ee5a5f8057739b8d072539" + amd64.url = "https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.41/AdGuardHome_linux_amd64.tar.gz" + amd64.sha256 = "9e171202103ff57bd4ddebc280cbc71eb7a33f5b1ba23170f462b3dfcdca93f5" + armhf.url = "https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.41/AdGuardHome_linux_armv7.tar.gz" + armhf.sha256 = "0ded3fcc63b009d7934730fd31e698b700153e6ac7dc205f5aa7352810a309d7" autoupdate.strategy = "latest_github_release" autoupdate.asset.amd64 = "^AdGuardHome_linux_amd64.tar.gz$" From 4b5a4d316cd246a0d939edd64c5cdf9ab0dd332d Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sat, 2 Dec 2023 23:12:15 +0000 Subject: [PATCH 11/13] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e3679c1..7bbd54a 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ AdGuard Home is a network-wide software for blocking ads & tracking. After you s It operates as a DNS server that re-routes tracking domains to a "black hole", thus preventing your devices from connecting to those servers. It's based on software we use for our public AdGuard DNS servers -- both share a lot of common code. -**Shipped version:** 0.107.27~ynh1 +**Shipped version:** 0.107.41~ynh1 ## Screenshots diff --git a/README_fr.md b/README_fr.md index 6de1685..9569cff 100644 --- a/README_fr.md +++ b/README_fr.md @@ -21,7 +21,7 @@ AdGuard Home est un logiciel à l'échelle du réseau pour bloquer les publicit Il fonctionne comme un serveur DNS qui redirige les domaines de pistage vers un "trou noir", empêchant ainsi vos appareils de se connecter à ces serveurs. Il est basé sur un logiciel que nous utilisons pour nos serveurs DNS publics AdGuard - les deux partagent beaucoup de code commun. -**Version incluse :** 0.107.27~ynh1 +**Version incluse :** 0.107.41~ynh1 ## Captures d’écran From 07ebb26dd6fa3d462da6e0bd21577a02952aada2 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin <4533074+alexAubin@users.noreply.github.com> Date: Sun, 3 Dec 2023 00:19:26 +0100 Subject: [PATCH 12/13] Update manifest.toml: apparently we gotta use in_subdir = "2" because wtf --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 752e75e..d741e31 100644 --- a/manifest.toml +++ b/manifest.toml @@ -51,7 +51,7 @@ ram.runtime = "50M" [resources] [resources.sources.main] - in_subdir = false + in_subdir = "2" arm64.url = "https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.41/AdGuardHome_linux_arm64.tar.gz" arm64.sha256 = "e23f5164a832c8647e0035b03189dc9c72821e9216ee5a5f8057739b8d072539" amd64.url = "https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.41/AdGuardHome_linux_amd64.tar.gz" From 854837b2ff6b2003f36d9cec3a9545ba679ec9a9 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin <4533074+alexAubin@users.noreply.github.com> Date: Sun, 3 Dec 2023 00:44:38 +0100 Subject: [PATCH 13/13] Update upgrade: adguard_port -> port_adguard --- scripts/upgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index a7dde02..d036e39 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -142,8 +142,8 @@ if \"0.0.0.0\" in conf_file[\"dns\"][\"bind_hosts\"]: conf_file[\"dns\"][\"bind_hosts\"].append(\"$ipv6_addr\") need_file_update = True -if conf_file[\"dns\"][\"port\"] != $adguard_port: - conf_file[\"dns\"][\"port\"] = $adguard_port +if conf_file[\"dns\"][\"port\"] != $port_adguard: + conf_file[\"dns\"][\"port\"] = $port_adguard need_file_update = True if need_file_update: