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