1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/hotspot_ynh.git synced 2024-09-03 19:25:53 +02:00

Add comment to explain the origin of the awk syntax

This commit is contained in:
Alexandre Aubin 2024-03-19 18:12:41 +01:00 committed by GitHub
parent f21df258cc
commit f93ffd83c3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -236,6 +236,10 @@ if [ "$1" != restart ]; then
ip4_nat_prefix=$(ynh_app_setting_get --app=$app --key=ip4_nat_prefix) ip4_nat_prefix=$(ynh_app_setting_get --app=$app --key=ip4_nat_prefix)
old_gateway_interface=$(ynh_app_setting_get --app=$app --key=gateway_interface) old_gateway_interface=$(ynh_app_setting_get --app=$app --key=gateway_interface)
# The awk syntax is to accomodate to the fact that the ip route output may look like:
# 1.2.3.4 via 192.168.1.254 dev end0 src 192.168.1.35 uid 0
# 1.2.3.4 dev vpn_iloth table 51820 src 5.6.7.8 uid 0
new_gateway_interface=$(ip route get 1.2.3.4 | awk '$2 ~ /^dev$/ { print $3; } $4 ~ /^dev$/ { print $5; }') new_gateway_interface=$(ip route get 1.2.3.4 | awk '$2 ~ /^dev$/ { print $3; } $4 ~ /^dev$/ { print $5; }')
echo "OK" echo "OK"