1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/adguardhome_ynh.git synced 2024-09-03 18:06:23 +02:00
This commit is contained in:
Éric Gaspar 2023-09-27 15:02:25 +02:00
parent 23170eb150
commit 013bb68cb4
9 changed files with 25 additions and 130 deletions

View file

@ -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__' ]
bind = "allow_unencrypted_doh:__INSTALL_DIR__/AdGuardHome.yaml"

View file

@ -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
}
]
}
}

View file

@ -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"

View file

@ -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

View file

@ -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"

View file

@ -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

View file

@ -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
#=================================================

View file

@ -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
#=================================================

View file

@ -0,0 +1,9 @@
test_format = 1.0
[default]
# -------------------------------
# Default args to use for install
# -------------------------------
args.dns_over_https=1