1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/adguardhome_ynh.git synced 2024-09-03 18:06:23 +02:00

update IPs on restore

This commit is contained in:
OniriCorpe 2023-12-27 07:25:48 +01:00
parent 09287bf217
commit 271cd9428a

View file

@ -41,6 +41,21 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
ynh_restore_file --origin_path="$install_dir"
# we need to update IP adresses in case the backup is restored in a different
# environment, else AGH will try to bind port 53 on non-existent IPs and crash
# get IPv4 for the AGH config file
ipv4_route_output=$(echo "$(ip -4 route get 1.2.3.4 2> /dev/null)" | head -n1 | head -n1)
ipv4_addr=$(process_ips "$ipv4_route_output")
# get IPv6 for the AGH config file
ipv6_route_output=$(echo "$(ip -6 route get ::1.2.3.4 2> /dev/null)" | head -n1)
ipv6_addr=$(process_ips "$ipv6_route_output")
# update the IP adresses in the AGH config file
update_config
# this will be treated as a security issue.
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"