mirror of
https://github.com/YunoHost-Apps/hotspot_ynh.git
synced 2024-09-03 19:25:53 +02:00
Fix error when there is no internet interface available (close #8)
This commit is contained in:
parent
8c92752728
commit
3ed39d684b
1 changed files with 8 additions and 4 deletions
|
@ -92,7 +92,7 @@ is_running() {
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
is_hostapd_running && is_forwarding_set && is_nat_set "${new_internet_device}"
|
is_hostapd_running && is_forwarding_set && ( [ -z "${new_internet_device}" ] || is_nat_set "${new_internet_device}" )
|
||||||
}
|
}
|
||||||
|
|
||||||
## Setters
|
## Setters
|
||||||
|
@ -340,7 +340,7 @@ case "$1" in
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set ipv4 NAT
|
# Set ipv4 NAT
|
||||||
if ! is_nat_set "${new_internet_device}"; then
|
if [ ! -z "${new_internet_device}" ] && ! is_nat_set "${new_internet_device}"; then
|
||||||
echo "Set NAT"
|
echo "Set NAT"
|
||||||
set_nat "${new_internet_device}"
|
set_nat "${new_internet_device}"
|
||||||
fi
|
fi
|
||||||
|
@ -415,7 +415,7 @@ case "$1" in
|
||||||
echo "[hotspot] Stopping..."
|
echo "[hotspot] Stopping..."
|
||||||
rm -f /tmp/.ynh-hotspot-started
|
rm -f /tmp/.ynh-hotspot-started
|
||||||
|
|
||||||
if is_nat_set "${old_internet_device}"; then
|
if [ ! -z "${old_internet_device}" ] && is_nat_set "${old_internet_device}"; then
|
||||||
echo "Unset NAT"
|
echo "Unset NAT"
|
||||||
unset_nat "${old_internet_device}"
|
unset_nat "${old_internet_device}"
|
||||||
fi
|
fi
|
||||||
|
@ -479,7 +479,11 @@ case "$1" in
|
||||||
if is_nat_set "${new_internet_device}"; then
|
if is_nat_set "${new_internet_device}"; then
|
||||||
echo "[OK] IPv4 NAT set"
|
echo "[OK] IPv4 NAT set"
|
||||||
else
|
else
|
||||||
echo "[ERR] No IPv4 NAT set"
|
if [ -z "${new_internet_device}" ]; then
|
||||||
|
echo "[INFO] No IPv4 NAT set (no internet interface)"
|
||||||
|
else
|
||||||
|
echo "[ERR] No IPv4 NAT set"
|
||||||
|
fi
|
||||||
exitcode=1
|
exitcode=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue