mirror of
https://github.com/YunoHost-Apps/adguardhome_ynh.git
synced 2024-09-03 18:06:23 +02:00
commit
8152bfc961
13 changed files with 123 additions and 102 deletions
|
@ -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.
|
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
|
## Screenshots
|
||||||
|
|
||||||
|
|
|
@ -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.
|
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
|
## Captures d’écran
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_URL=https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.36/AdGuardHome_linux_amd64.tar.gz
|
SOURCE_URL=https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.37/AdGuardHome_linux_amd64.tar.gz
|
||||||
SOURCE_SUM=b06eb8b75c7bd2e2a4f38e1d4f583d1b327e0e01eebfbb14101695aa812658ec
|
SOURCE_SUM=9aeb96f09e781451526f521d277e22cd9f28784113767e1823e445702d113ce3
|
||||||
SOURCE_SUM_PRG=sha256sum
|
SOURCE_SUM_PRG=sha256sum
|
||||||
SOURCE_FORMAT=tar.gz
|
SOURCE_FORMAT=tar.gz
|
||||||
SOURCE_IN_SUBDIR=2
|
SOURCE_IN_SUBDIR=2
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_URL=https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.36/AdGuardHome_linux_arm64.tar.gz
|
SOURCE_URL=https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.37/AdGuardHome_linux_arm64.tar.gz
|
||||||
SOURCE_SUM=ad449fa35b8919bc71d67fd570bcaae73aa20e8e20d1c682a5570bdae6544a41
|
SOURCE_SUM=d0a352bf77b9109c6cc93285fec0e060eeb4ab01cb4863b9be42a37a0c3c3997
|
||||||
SOURCE_SUM_PRG=sha256sum
|
SOURCE_SUM_PRG=sha256sum
|
||||||
SOURCE_FORMAT=tar.gz
|
SOURCE_FORMAT=tar.gz
|
||||||
SOURCE_IN_SUBDIR=2
|
SOURCE_IN_SUBDIR=2
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_URL=https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.36/AdGuardHome_linux_armv7.tar.gz
|
SOURCE_URL=https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.37/AdGuardHome_linux_armv7.tar.gz
|
||||||
SOURCE_SUM=9931ae7cc20a923d91ed0b8d58a48a32df4a7709597bd391b492b984869e1ff1
|
SOURCE_SUM=add136ab6dbf0a81136c3af7fa42660707ae577b1016d9cad2ce0bcc5c9e7cc7
|
||||||
SOURCE_SUM_PRG=sha256sum
|
SOURCE_SUM_PRG=sha256sum
|
||||||
SOURCE_FORMAT=tar.gz
|
SOURCE_FORMAT=tar.gz
|
||||||
SOURCE_IN_SUBDIR=2
|
SOURCE_IN_SUBDIR=2
|
||||||
|
|
|
@ -3,13 +3,14 @@ version = "1.0"
|
||||||
[main]
|
[main]
|
||||||
name = "Adguard configuration"
|
name = "Adguard configuration"
|
||||||
|
|
||||||
[main.options]
|
services = ["__APP__"]
|
||||||
name = "Enable some features"
|
|
||||||
|
|
||||||
[main.options.dns_over_https]
|
[main.options]
|
||||||
ask = "Enable DNS-over-HTTPS"
|
name = "Enable some features"
|
||||||
type = "boolean"
|
|
||||||
yes = "true"
|
[main.options.dns_over_https]
|
||||||
no = "false"
|
ask = "Enable DNS-over-HTTPS"
|
||||||
bind = "allow_unencrypted_doh:__FINALPATH__/AdGuardHome.yaml"
|
bind = "allow_unencrypted_doh:__FINALPATH__/AdGuardHome.yaml"
|
||||||
services = [ '__APP__' ]
|
no = "false"
|
||||||
|
type = "boolean"
|
||||||
|
yes = "true"
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"en": "Network-wide ads & trackers blocking DNS server",
|
"en": "Network-wide ads & trackers blocking DNS server",
|
||||||
"fr": "Serveur DNS, bloqueur de publicités et trackers"
|
"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",
|
"url": "https://adguard.com/adguard-home.html",
|
||||||
"upstream": {
|
"upstream": {
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
|
|
|
@ -27,8 +27,8 @@ ynh_print_info --message="Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||||
|
|
|
@ -27,8 +27,8 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
|
|
||||||
# Needed for helper "ynh_add_nginx_config"
|
# Needed for helper "ynh_add_nginx_config"
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
port=$(ynh_app_setting_get --app="$app" --key=port)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
||||||
|
@ -70,7 +70,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
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
|
# MODIFY URL IN NGINX CONF
|
||||||
|
@ -96,7 +96,7 @@ if [ $change_domain -eq 1 ]
|
||||||
then
|
then
|
||||||
# Delete file checksum for the old conf file location
|
# Delete file checksum for the old conf file location
|
||||||
ynh_delete_file_checksum --file="$nginx_conf_path"
|
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
|
# Store file checksum for the new config file location
|
||||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||||
fi
|
fi
|
||||||
|
@ -108,7 +108,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
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
|
# RELOAD NGINX
|
||||||
|
|
|
@ -36,37 +36,37 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
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"
|
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||||
|
|
||||||
# Register (book) web path
|
# 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
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Storing installation settings..." --weight=2
|
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=domain --value="$domain"
|
||||||
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
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=admin --value="$admin"
|
||||||
|
|
||||||
if [ "$dns_over_https" == "1" ];
|
if [ "$dns_over_https" == "1" ];
|
||||||
then
|
then
|
||||||
dns_over_https="true"
|
dns_over_https="true"
|
||||||
# DNS over TLS
|
# DNS over TLS
|
||||||
adguard_DoT_port=853
|
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 UDP $adguard_DoT_port
|
||||||
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $adguard_DoT_port
|
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $adguard_DoT_port
|
||||||
# DNS over QUIC
|
# DNS over QUIC
|
||||||
adguard_DoQ_port=784
|
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
|
ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $adguard_DoQ_port
|
||||||
else
|
else
|
||||||
dns_over_https="false"
|
dns_over_https="false"
|
||||||
fi
|
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
|
# STANDARD MODIFICATIONS
|
||||||
|
@ -77,11 +77,11 @@ ynh_script_progression --message="Finding an available port..." --weight=1
|
||||||
|
|
||||||
# Find an available port
|
# Find an available port
|
||||||
port=$(ynh_find_port --port=3000)
|
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
|
# Find an available port
|
||||||
adguard_port=53
|
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
|
# 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 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_script_progression --message="Installing dependencies..." --weight=1
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies "$pkg_dependencies"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
|
@ -100,22 +100,22 @@ ynh_install_app_dependencies $pkg_dependencies
|
||||||
ynh_script_progression --message="Configuring system user..." --weight=1
|
ynh_script_progression --message="Configuring system user..." --weight=1
|
||||||
|
|
||||||
# Create a system user
|
# 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
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up source files..." --weight=4
|
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
|
# 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 750 "$final_path"
|
||||||
chmod -R o-rwx "$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
|
# 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)
|
ipv6_route_output=$(echo "$(ip -6 route get ::1.2.3.4 2> /dev/null)" | head -n1)
|
||||||
|
|
||||||
ipv4_addr=""
|
ipv4_addr=""
|
||||||
for i in $(seq "$(echo $ipv4_route_output | wc -w)" -1 1); do
|
for i in $(seq "$(echo "$ipv4_route_output" | wc -w)" -1 1); do
|
||||||
ip=$(echo $ipv4_route_output | awk "{print \$$i}")
|
ip=$(echo "$ipv4_route_output" | awk "{print \$$i}")
|
||||||
if ynh_validate_ip4 --ip_address=$ip; then
|
if ynh_validate_ip4 --ip_address="$ip"; then
|
||||||
ipv4_addr="- $ip"
|
ipv4_addr="- $ip"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
ipv6_addr=""
|
ipv6_addr=""
|
||||||
for i in $(seq "$(echo $ipv6_route_output | wc -w)" -1 1); do
|
for i in $(seq "$(echo "$ipv6_route_output" | wc -w)" -1 1); do
|
||||||
ip=$(echo $ipv6_route_output | awk "{print \$$i}")
|
ip=$(echo "$ipv6_route_output" | awk "{print \$$i}")
|
||||||
if ynh_validate_ip6 --ip_address=$ip; then
|
if ynh_validate_ip6 --ip_address="$ip"; then
|
||||||
ipv6_addr="- $ip"
|
ipv6_addr="- $ip"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
password=$(python3 -c "import bcrypt; print(bcrypt.hashpw(b\"$password\", bcrypt.gensalt(rounds=10)).decode())")
|
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
|
# Main config File
|
||||||
ynh_add_config --template="../conf/AdGuardHome.yaml" --destination="$final_path/AdGuardHome.yaml"
|
ynh_add_config --template="../conf/AdGuardHome.yaml" --destination="$final_path/AdGuardHome.yaml"
|
||||||
|
|
||||||
chmod 600 "$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
|
# SETUP SYSTEMD
|
||||||
|
@ -199,7 +199,7 @@ ynh_add_systemd_config
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
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
|
# 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
|
ynh_script_progression --message="Starting a systemd service..." --weight=2
|
||||||
|
|
||||||
# Start a systemd service
|
# 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
|
# SETUP SSOWAT
|
||||||
|
|
|
@ -16,10 +16,10 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
port=$(ynh_app_setting_get --app="$app" --key=port)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
||||||
adguard_port=$(ynh_app_setting_get --app=$app --key=adguard_port)
|
adguard_port=$(ynh_app_setting_get --app="$app" --key=adguard_port)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# 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`)
|
# 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
|
then
|
||||||
ynh_script_progression --message="Removing $app service integration..." --weight=1
|
ynh_script_progression --message="Removing $app service integration..." --weight=1
|
||||||
yunohost service remove $app
|
yunohost service remove "$app"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -73,7 +73,7 @@ ynh_remove_app_dependencies
|
||||||
if yunohost firewall list | grep -q "\- $adguard_port$"
|
if yunohost firewall list | grep -q "\- $adguard_port$"
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Closing port $adguard_port..." --weight=1
|
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
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -82,7 +82,7 @@ fi
|
||||||
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
||||||
|
|
||||||
# Delete a system user
|
# Delete a system user
|
||||||
ynh_system_user_delete --username=$app
|
ynh_system_user_delete --username="$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
|
@ -27,17 +27,17 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
||||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
path_url=$(ynh_app_setting_get --app="$app" --key=path)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
||||||
adguard_port=$(ynh_app_setting_get --app=$app --key=adguard_port)
|
adguard_port=$(ynh_app_setting_get --app="$app" --key=adguard_port)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
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 "
|
|| 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
|
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
||||||
|
|
||||||
# Create the dedicated user (if not existing)
|
# 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
|
# RESTORE THE APP MAIN DIR
|
||||||
|
@ -60,14 +60,34 @@ ynh_restore_file --origin_path="$final_path"
|
||||||
# this will be treated as a security issue.
|
# this will be treated as a security issue.
|
||||||
chmod 750 "$final_path"
|
chmod 750 "$final_path"
|
||||||
chmod -R o-rwx "$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"
|
ynh_restore_file --origin_path="/etc/dnsmasq.d/$app"
|
||||||
|
|
||||||
systemctl restart dnsmasq
|
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
|
# SPECIFIC RESTORATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -76,7 +96,7 @@ systemctl restart dnsmasq
|
||||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
|
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
|
||||||
|
|
||||||
# Define and install dependencies
|
# Define and install dependencies
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies "$pkg_dependencies"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
# 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_script_progression --message="Restoring the systemd configuration..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||||
systemctl enable $app.service --quiet
|
systemctl enable "$app.service" --quiet
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
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
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
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
|
# GENERIC FINALIZATION
|
||||||
|
|
|
@ -16,14 +16,14 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
||||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
path_url=$(ynh_app_setting_get --app="$app" --key=path)
|
||||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
admin=$(ynh_app_setting_get --app="$app" --key=admin)
|
||||||
password=$(ynh_app_setting_get --app=$app --key=password)
|
password=$(ynh_app_setting_get --app="$app" --key=password)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
port=$(ynh_app_setting_get --app="$app" --key=port)
|
||||||
adguard_port=$(ynh_app_setting_get --app=$app --key=adguard_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)
|
dns_over_https=$(ynh_app_setting_get --app="$app" --key=dns_over_https)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK VERSION
|
# CHECK VERSION
|
||||||
|
@ -54,11 +54,11 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
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
|
# 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 TCP "$adguard_port"
|
||||||
ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $adguard_port
|
ynh_exec_warn_less yunohost firewall allow --no-upnp UDP "$adguard_port"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
|
@ -69,13 +69,13 @@ ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||||
if ynh_legacy_permissions_exists; then
|
if ynh_legacy_permissions_exists; then
|
||||||
ynh_legacy_permissions_delete_all
|
ynh_legacy_permissions_delete_all
|
||||||
|
|
||||||
ynh_app_setting_delete --app=$app --key=is_public
|
ynh_app_setting_delete --app="$app" --key=is_public
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# The dns port should be 53
|
# The dns port should be 53
|
||||||
if [ "$adguard_port" -ne "53" ]; then
|
if [ "$adguard_port" -ne "53" ]; then
|
||||||
adguard_port=53
|
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
|
fi
|
||||||
|
|
||||||
# Create a permission if needed
|
# Create a permission if needed
|
||||||
|
@ -86,20 +86,20 @@ fi
|
||||||
if [ -n "$dns_over_https" ] && [ "$dns_over_https" == "1" ];
|
if [ -n "$dns_over_https" ] && [ "$dns_over_https" == "1" ];
|
||||||
then
|
then
|
||||||
dns_over_https="true"
|
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
|
# DNS over TLS
|
||||||
adguard_DoT_port=853
|
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 UDP $adguard_DoT_port
|
||||||
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $adguard_DoT_port
|
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $adguard_DoT_port
|
||||||
# DNS over QUIC
|
# DNS over QUIC
|
||||||
adguard_DoQ_port=784
|
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
|
ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $adguard_DoQ_port
|
||||||
elif [ -z "$dns_over_https" ] || [ "$dns_over_https" == "0" ];
|
elif [ -z "$dns_over_https" ] || [ "$dns_over_https" == "0" ];
|
||||||
then
|
then
|
||||||
dns_over_https="false"
|
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
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -108,7 +108,7 @@ fi
|
||||||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
||||||
|
|
||||||
# Create a dedicated user (if not existing)
|
# 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
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
|
@ -119,21 +119,21 @@ then
|
||||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# 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
|
fi
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
chmod 750 "$final_path"
|
||||||
chmod -R o-rwx "$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
|
# UPGRADE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading dependencies..." --weight=1
|
ynh_script_progression --message="Upgrading dependencies..." --weight=1
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies "$pkg_dependencies"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# 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)
|
ipv6_route_output=$(echo "$(ip -6 route get ::1.2.3.4 2> /dev/null)" | head -n1)
|
||||||
|
|
||||||
ipv4_addr=""
|
ipv4_addr=""
|
||||||
for i in $(seq "$(echo $ipv4_route_output | wc -w)" -1 1); do
|
for i in $(seq "$(echo "$ipv4_route_output" | wc -w)" -1 1); do
|
||||||
ip=$(echo $ipv4_route_output | awk "{print \$$i}")
|
ip=$(echo "$ipv4_route_output" | awk "{print \$$i}")
|
||||||
if ynh_validate_ip4 --ip_address=$ip; then
|
if ynh_validate_ip4 --ip_address="$ip"; then
|
||||||
ipv4_addr="$ip"
|
ipv4_addr="$ip"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
ipv6_addr=""
|
ipv6_addr=""
|
||||||
for i in $(seq "$(echo $ipv6_route_output | wc -w)" -1 1); do
|
for i in $(seq "$(echo "$ipv6_route_output" | wc -w)" -1 1); do
|
||||||
ip=$(echo $ipv6_route_output | awk "{print \$$i}")
|
ip=$(echo "$ipv6_route_output" | awk "{print \$$i}")
|
||||||
if ynh_validate_ip6 --ip_address=$ip; then
|
if ynh_validate_ip6 --ip_address="$ip"; then
|
||||||
ipv6_addr="$ip"
|
ipv6_addr="$ip"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
@ -217,7 +217,7 @@ if need_file_update:
|
||||||
"
|
"
|
||||||
|
|
||||||
chmod 600 "$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
|
# SETUP SYSTEMD
|
||||||
|
@ -232,14 +232,14 @@ ynh_add_systemd_config
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
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
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
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
|
# RELOAD NGINX
|
||||||
|
|
Loading…
Reference in a new issue