Merge "Remove quotes from subshell call in bash script"
This commit is contained in:
commit
ce16f9d38c
1 changed files with 9 additions and 13 deletions
|
@ -63,7 +63,8 @@ function config_exists() {
|
||||||
|
|
||||||
function inspect_interface() {
|
function inspect_interface() {
|
||||||
local interface=$1
|
local interface=$1
|
||||||
local mac_addr_type="$(cat /sys/class/net/${interface}/addr_assign_type)"
|
local mac_addr_type
|
||||||
|
mac_addr_type=$(cat /sys/class/net/${interface}/addr_assign_type)
|
||||||
|
|
||||||
echo -n "Inspecting interface: $interface..."
|
echo -n "Inspecting interface: $interface..."
|
||||||
if config_exists $interface; then
|
if config_exists $interface; then
|
||||||
|
@ -72,25 +73,20 @@ function inspect_interface() {
|
||||||
echo "Device has generated MAC, skipping."
|
echo "Device has generated MAC, skipping."
|
||||||
else
|
else
|
||||||
ip link set dev $interface up &>/dev/null
|
ip link set dev $interface up &>/dev/null
|
||||||
HAS_LINK="$(get_if_link $interface)"
|
|
||||||
|
|
||||||
TRIES=10
|
local has_link
|
||||||
while [ "$HAS_LINK" == "0" -a $TRIES -gt 0 ]; do
|
local tries
|
||||||
HAS_LINK="$(get_if_link $interface)"
|
for ((tries = 0; tries < 10; tries++)); do
|
||||||
if [ "$HAS_LINK" == "1" ]; then
|
has_link=$(get_if_link $interface)
|
||||||
break
|
[ "$has_link" == "1" ] && break
|
||||||
else
|
|
||||||
sleep 1
|
sleep 1
|
||||||
fi
|
|
||||||
TRIES=$(( TRIES - 1 ))
|
|
||||||
done
|
done
|
||||||
if [ "$HAS_LINK" == "1" ] ; then
|
if [ "$has_link" == "1" ]; then
|
||||||
enable_interface "$interface"
|
enable_interface "$interface"
|
||||||
else
|
else
|
||||||
echo "No link detected, skipping"
|
echo "No link detected, skipping"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -n "$INTERFACE" ]; then
|
if [ -n "$INTERFACE" ]; then
|
||||||
|
|
Loading…
Reference in a new issue