fix: 保留eno3,服务之间不再相互依赖
This commit is contained in:
@@ -7,38 +7,23 @@ source "${SCRIPT_DIR}/common.sh"
|
||||
|
||||
STEP="5g-dial"
|
||||
|
||||
disable_interfaces() {
|
||||
local raw_list="$1"
|
||||
local iface
|
||||
local nmcli_available=0
|
||||
run_dial() {
|
||||
local rc
|
||||
|
||||
if [[ -z "${raw_list}" ]]; then
|
||||
export TERM="${TERM:-xterm}"
|
||||
export LANG="${LANG:-C.UTF-8}"
|
||||
export LC_ALL="${LC_ALL:-C.UTF-8}"
|
||||
|
||||
blitz_log "${STEP}" "dial-env" "start" "TERM=${TERM} LANG=${LANG} LC_ALL=${LC_ALL} interface=${BLITZ_5G_INTERFACE}" 0
|
||||
|
||||
if blitz_run "${STEP}" "dial" python3 rndis_dial.py --serial-port "${BLITZ_5G_SERIAL_PORT}" --interface "${BLITZ_5G_INTERFACE}"; then
|
||||
return 0
|
||||
fi
|
||||
if command -v nmcli >/dev/null 2>&1; then
|
||||
nmcli_available=1
|
||||
fi
|
||||
|
||||
for iface in ${raw_list//,/ }; do
|
||||
if [[ -z "${iface}" ]]; then
|
||||
continue
|
||||
fi
|
||||
blitz_log "${STEP}" "disable-interface" "start" "iface=${iface}" 0
|
||||
if [[ "${nmcli_available}" -eq 1 ]]; then
|
||||
nmcli device disconnect "${iface}" >/dev/null 2>&1 || true
|
||||
fi
|
||||
if ip link show dev "${iface}" >/dev/null 2>&1; then
|
||||
if ip link set dev "${iface}" down; then
|
||||
blitz_log "${STEP}" "disable-interface" "success" "iface=${iface}" 0
|
||||
else
|
||||
rc=$?
|
||||
blitz_log "${STEP}" "disable-interface" "failure" "iface=${iface}" "${rc}"
|
||||
return "${rc}"
|
||||
fi
|
||||
else
|
||||
blitz_log "${STEP}" "disable-interface" "success" "iface=${iface} not present, skipping" 0
|
||||
fi
|
||||
done
|
||||
rc=$?
|
||||
blitz_log "${STEP}" "dial-retry" "start" "first dial attempt failed rc=${rc}; retrying after 3s" "${rc}"
|
||||
sleep 3
|
||||
blitz_run "${STEP}" "dial-retry" python3 rndis_dial.py --serial-port "${BLITZ_5G_SERIAL_PORT}" --interface "${BLITZ_5G_INTERFACE}"
|
||||
}
|
||||
|
||||
wait_for_serial() {
|
||||
@@ -101,8 +86,6 @@ if [[ -z "${BLITZ_5G_INTERFACE:-}" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
disable_interfaces "${BLITZ_5G_DISABLE_INTERFACES:-}"
|
||||
|
||||
route_output="$(blitz_route_ready "${BLITZ_TIME_SERVER_IP}" "${BLITZ_5G_INTERFACE}" || true)"
|
||||
if [[ -n "${route_output}" ]]; then
|
||||
blitz_log "${STEP}" "dial" "already_up" "target_ip=${BLITZ_TIME_SERVER_IP} interface=${BLITZ_5G_INTERFACE} route=${route_output}" 0
|
||||
@@ -112,7 +95,7 @@ fi
|
||||
wait_for_serial "${BLITZ_5G_SERIAL_PORT}" "${BLITZ_5G_SERIAL_WAIT_SEC}"
|
||||
|
||||
pushd "${BLITZ_5G_DIAL_DIR}" >/dev/null
|
||||
blitz_run "${STEP}" "dial" python3 rndis_dial.py --serial-port "${BLITZ_5G_SERIAL_PORT}" --interface "${BLITZ_5G_INTERFACE}"
|
||||
run_dial
|
||||
popd >/dev/null
|
||||
|
||||
wait_for_route "${BLITZ_TIME_SERVER_IP}" "${BLITZ_5G_ROUTE_WAIT_SEC}" "${BLITZ_5G_INTERFACE}"
|
||||
|
||||
Reference in New Issue
Block a user