diff --git a/README.md b/README.md index e72b54c..1eb93c9 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.36~ynh1 +**Shipped version:** 0.107.37~ynh1 ## Screenshots diff --git a/README_fr.md b/README_fr.md index 5cda8ab..c33184f 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.36~ynh1 +**Version incluse :** 0.107.37~ynh1 ## Captures d’écran diff --git a/conf/amd64.src b/conf/amd64.src index cd2968d..9304c7f 100644 --- a/conf/amd64.src +++ b/conf/amd64.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.36/AdGuardHome_linux_amd64.tar.gz -SOURCE_SUM=b06eb8b75c7bd2e2a4f38e1d4f583d1b327e0e01eebfbb14101695aa812658ec +SOURCE_URL=https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.37/AdGuardHome_linux_amd64.tar.gz +SOURCE_SUM=9aeb96f09e781451526f521d277e22cd9f28784113767e1823e445702d113ce3 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=2 diff --git a/conf/arm64.src b/conf/arm64.src index a7a21ba..912ed21 100644 --- a/conf/arm64.src +++ b/conf/arm64.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.36/AdGuardHome_linux_arm64.tar.gz -SOURCE_SUM=ad449fa35b8919bc71d67fd570bcaae73aa20e8e20d1c682a5570bdae6544a41 +SOURCE_URL=https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.37/AdGuardHome_linux_arm64.tar.gz +SOURCE_SUM=d0a352bf77b9109c6cc93285fec0e060eeb4ab01cb4863b9be42a37a0c3c3997 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=2 diff --git a/conf/armhf.src b/conf/armhf.src index e740458..1d35d81 100644 --- a/conf/armhf.src +++ b/conf/armhf.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.36/AdGuardHome_linux_armv7.tar.gz -SOURCE_SUM=9931ae7cc20a923d91ed0b8d58a48a32df4a7709597bd391b492b984869e1ff1 +SOURCE_URL=https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.37/AdGuardHome_linux_armv7.tar.gz +SOURCE_SUM=add136ab6dbf0a81136c3af7fa42660707ae577b1016d9cad2ce0bcc5c9e7cc7 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=2 diff --git a/config_panel.toml b/config_panel.toml index f57cd51..fd8de27 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -3,13 +3,14 @@ version = "1.0" [main] name = "Adguard configuration" - [main.options] - name = "Enable some features" +services = ["__APP__"] - [main.options.dns_over_https] - ask = "Enable DNS-over-HTTPS" - type = "boolean" - yes = "true" - no = "false" - bind = "allow_unencrypted_doh:__FINALPATH__/AdGuardHome.yaml" - services = [ '__APP__' ] \ No newline at end of file +[main.options] +name = "Enable some features" + +[main.options.dns_over_https] +ask = "Enable DNS-over-HTTPS" +bind = "allow_unencrypted_doh:__FINALPATH__/AdGuardHome.yaml" +no = "false" +type = "boolean" +yes = "true" diff --git a/manifest.json b/manifest.json index 194feb8..816b53b 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Network-wide ads & trackers blocking DNS server", "fr": "Serveur DNS, bloqueur de publicités et trackers" }, - "version": "0.107.36~ynh1", + "version": "0.107.37~ynh1", "url": "https://adguard.com/adguard-home.html", "upstream": { "license": "GPL-3.0", diff --git a/scripts/backup b/scripts/backup index 27063e5..7062e29 100644 --- a/scripts/backup +++ b/scripts/backup @@ -27,8 +27,8 @@ ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -domain=$(ynh_app_setting_get --app=$app --key=domain) +final_path=$(ynh_app_setting_get --app="$app" --key=final_path) +domain=$(ynh_app_setting_get --app="$app" --key=domain) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP diff --git a/scripts/change_url b/scripts/change_url index eca2bc2..42c3942 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -27,8 +27,8 @@ app=$YNH_APP_INSTANCE_NAME 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) +final_path=$(ynh_app_setting_get --app="$app" --key=final_path) +port=$(ynh_app_setting_get --app="$app" --key=port) #================================================= # BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP @@ -70,7 +70,7 @@ fi #================================================= 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" #================================================= # MODIFY URL IN NGINX CONF @@ -96,7 +96,7 @@ 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 + 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" fi @@ -108,7 +108,7 @@ fi #================================================= 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" #================================================= # RELOAD NGINX diff --git a/scripts/install b/scripts/install index 126161b..29e323c 100644 --- a/scripts/install +++ b/scripts/install @@ -36,37 +36,37 @@ app=$YNH_APP_INSTANCE_NAME #================================================= ynh_script_progression --message="Validating installation parameters..." --weight=1 -final_path=/var/www/$app +final_path="/var/www/$app" test ! -e "$final_path" || ynh_die --message="This path already contains a folder" # Register (book) web path -ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url +ynh_webpath_register --app="$app" --domain="$domain" --path_url="$path_url" #================================================= # STORE SETTINGS FROM MANIFEST #================================================= 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 +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" 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 + 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 + 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" fi -ynh_app_setting_set --app=$app --key=dns_over_https --value=$dns_over_https +ynh_app_setting_set --app="$app" --key=dns_over_https --value=$dns_over_https #================================================= # STANDARD MODIFICATIONS @@ -77,11 +77,11 @@ 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 +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 +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 @@ -92,7 +92,7 @@ ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $adguard_port #================================================= ynh_script_progression --message="Installing dependencies..." --weight=1 -ynh_install_app_dependencies $pkg_dependencies +ynh_install_app_dependencies "$pkg_dependencies" #================================================= # CREATE DEDICATED USER @@ -100,22 +100,22 @@ ynh_install_app_dependencies $pkg_dependencies 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" +ynh_system_user_create --username="$app" --home_dir="$final_path" --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 +ynh_app_setting_set --app="$app" --key=final_path --value="$final_path" # 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="$final_path" --source_id="$YNH_ARCH" chmod 750 "$final_path" chmod -R o-rwx "$final_path" -chown -R $app:$app "$final_path" +chown -R "$app":"$app" "$final_path" -setcap 'CAP_NET_BIND_SERVICE=+eip CAP_NET_RAW=+eip' $final_path/AdGuardHome +setcap 'CAP_NET_BIND_SERVICE=+eip CAP_NET_RAW=+eip' "$final_path"/AdGuardHome #================================================= # NGINX CONFIGURATION @@ -158,31 +158,31 @@ 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 +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 +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 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 +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" chmod 600 "$final_path/AdGuardHome.yaml" -chown -R $app:$app "$final_path/AdGuardHome.yaml" +chown -R "$app":"$app" "$final_path/AdGuardHome.yaml" #================================================= # SETUP SYSTEMD @@ -199,7 +199,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 $adguard_port #================================================= # START SYSTEMD SERVICE @@ -207,7 +207,7 @@ yunohost service add $app --description="Ads & trackers blocking DNS server" --n 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 +ynh_systemd_action --service_name="$app" --action="restart" --log_path=systemd #================================================= # SETUP SSOWAT diff --git a/scripts/remove b/scripts/remove index 55b8349..307ae29 100644 --- a/scripts/remove +++ b/scripts/remove @@ -16,10 +16,10 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 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) +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) #================================================= # STANDARD REMOVE @@ -28,10 +28,10 @@ adguard_port=$(ynh_app_setting_get --app=$app --key=adguard_port) #================================================= # Remove the service from the list of services known by YunoHost (added from `yunohost service add`) -if ynh_exec_warn_less yunohost service status $app >/dev/null +if ynh_exec_warn_less yunohost service status "$app" >/dev/null then ynh_script_progression --message="Removing $app service integration..." --weight=1 - yunohost service remove $app + yunohost service remove "$app" fi #================================================= @@ -73,7 +73,7 @@ ynh_remove_app_dependencies 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 + ynh_exec_warn_less yunohost firewall disallow TCP "$adguard_port" fi #================================================= @@ -82,7 +82,7 @@ fi ynh_script_progression --message="Removing the dedicated system user..." --weight=1 # Delete a system user -ynh_system_user_delete --username=$app +ynh_system_user_delete --username="$app" #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index 065e38d..a4f761d 100644 --- a/scripts/restore +++ b/scripts/restore @@ -27,17 +27,17 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 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) +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) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= ynh_script_progression --message="Validating restoration parameters..." --weight=1 -test ! -d $final_path \ +test ! -d "$final_path" \ || ynh_die --message="There is already a directory: $final_path " #================================================= @@ -48,7 +48,7 @@ test ! -d $final_path \ 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" +ynh_system_user_create --username="$app" --home_dir="$final_path" #================================================= # RESTORE THE APP MAIN DIR @@ -60,14 +60,34 @@ ynh_restore_file --origin_path="$final_path" # this will be treated as a security issue. chmod 750 "$final_path" chmod -R o-rwx "$final_path" -chown -R $app:$app "$final_path" +chown -R "$app":"$app" "$final_path" -setcap 'CAP_NET_BIND_SERVICE=+eip CAP_NET_RAW=+eip' $final_path/AdGuardHome +setcap 'CAP_NET_BIND_SERVICE=+eip CAP_NET_RAW=+eip' "$final_path"/AdGuardHome ynh_restore_file --origin_path="/etc/dnsmasq.d/$app" systemctl restart dnsmasq +#================================================= +# DOWNLOAD, CHECK AND UNPACK SOURCE +#================================================= + +# compare if the system arch is different from the binary arch +# if so, download the correct binary +if [ "$(uname -m)" != "$(file "$final_path"/AdGuardHome | cut -d ',' -f 2 | tr -d ' ')" ] +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" +fi + +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R "$app":"$app" "$final_path" + +setcap 'CAP_NET_BIND_SERVICE=+eip CAP_NET_RAW=+eip' "$final_path"/AdGuardHome + #================================================= # SPECIFIC RESTORATION #================================================= @@ -76,7 +96,7 @@ systemctl restart dnsmasq ynh_script_progression --message="Reinstalling dependencies..." --weight=1 # Define and install dependencies -ynh_install_app_dependencies $pkg_dependencies +ynh_install_app_dependencies "$pkg_dependencies" #================================================= # RESTORE THE NGINX CONFIGURATION @@ -91,21 +111,21 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" 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 +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 $adguard_port +yunohost service add "$app" --description="Ads & trackers blocking DNS server" --needs_exposed_ports "$adguard_port" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd" +ynh_systemd_action --service_name="$app" --action="restart" --log_path="systemd" #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index 0f075bb..1336821 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -16,14 +16,14 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 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) +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) #================================================= # CHECK VERSION @@ -54,11 +54,11 @@ ynh_abort_if_errors #================================================= 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" # 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 +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 @@ -69,13 +69,13 @@ ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 if ynh_legacy_permissions_exists; then ynh_legacy_permissions_delete_all - ynh_app_setting_delete --app=$app --key=is_public + 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 - ynh_app_setting_set --app=$app --key=adguard_port --value=$adguard_port + ynh_app_setting_set --app="$app" --key=adguard_port --value="$adguard_port" fi # Create a permission if needed @@ -86,20 +86,20 @@ 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 + 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 + 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 + 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 dns_over_https="false" - ynh_app_setting_set --app=$app --key=dns_over_https --value=$dns_over_https + ynh_app_setting_set --app="$app" --key=dns_over_https --value=$dns_over_https fi #================================================= @@ -108,7 +108,7 @@ fi 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" +ynh_system_user_create --username="$app" --home_dir="$final_path" --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="$final_path" --source_id="$YNH_ARCH" fi chmod 750 "$final_path" chmod -R o-rwx "$final_path" -chown -R $app:$app "$final_path" +chown -R "$app":"$app" "$final_path" -setcap 'CAP_NET_BIND_SERVICE=+eip CAP_NET_RAW=+eip' $final_path/AdGuardHome +setcap 'CAP_NET_BIND_SERVICE=+eip CAP_NET_RAW=+eip' "$final_path"/AdGuardHome #================================================= # UPGRADE DEPENDENCIES #================================================= ynh_script_progression --message="Upgrading dependencies..." --weight=1 -ynh_install_app_dependencies $pkg_dependencies +ynh_install_app_dependencies "$pkg_dependencies" #================================================= # NGINX CONFIGURATION @@ -175,18 +175,18 @@ 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 +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 +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 @@ -217,7 +217,7 @@ if need_file_update: " chmod 600 "$final_path/AdGuardHome.yaml" -chown -R $app:$app "$final_path/AdGuardHome.yaml" +chown -R "$app":"$app" "$final_path/AdGuardHome.yaml" #================================================= # SETUP SYSTEMD @@ -232,14 +232,14 @@ 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 "$adguard_port" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd" +ynh_systemd_action --service_name="$app" --action="restart" --log_path="systemd" #================================================= # RELOAD NGINX