Skip to content

Commit

Permalink
Merge pull request #125 from YunoHost-Apps/testing
Browse files Browse the repository at this point in the history
Testing v0.107.37
  • Loading branch information
OniriCorpe authored Sep 7, 2023
2 parents 975e7b3 + 0b58aba commit 8152bfc
Show file tree
Hide file tree
Showing 13 changed files with 124 additions and 103 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion README_fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions conf/amd64.src
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions conf/arm64.src
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions conf/armhf.src
Original file line number Diff line number Diff line change
@@ -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
Expand Down
21 changes: 11 additions & 10 deletions config_panel.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ version = "1.0"
[main]
name = "Adguard configuration"

[main.options]
name = "Enable some features"

[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__' ]
services = ["__APP__"]

[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"
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions scripts/backup
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions scripts/change_url
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
52 changes: 26 additions & 26 deletions scripts/install
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -92,30 +92,30 @@ 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
#=================================================
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
Expand Down Expand Up @@ -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
Expand All @@ -199,15 +199,15 @@ 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=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
Expand Down
16 changes: 8 additions & 8 deletions scripts/remove
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

#=================================================
Expand Down Expand Up @@ -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

#=================================================
Expand All @@ -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
Expand Down
Loading

0 comments on commit 8152bfc

Please sign in to comment.