From 66216504ee263cbf110bc379685a1342e65015a5 Mon Sep 17 00:00:00 2001 From: Alexandre Bard Date: Mon, 14 Nov 2022 13:48:47 +0100 Subject: [PATCH] um-service-cfg: Small improvements Since kernel 5.10 upgrade, this script was actually not working properly. The script is waiting on network.target to be ready, but network.target does not mean that the route to user module is already setup. And since with kernel 5.10 the route needs a bridge to be setup, this takes a bit longer to be ready. When there is no route to an IP address, ping does not wait the specified timeout (-W) and returns immediately with an error. this was leading to the 30 pings being done over a much smaller time period than expected and therefore made the service fail before the route was setup. Also in case the user module was not found, the service did not fail but continued checking the port, which failed (of course) and the script was then wrongly assuming the presence of an old UM. BugzID: 81969 --- .../um-service-cfg/files/um-service-config.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/recipes-user-module/um-service-cfg/files/um-service-config.sh b/recipes-user-module/um-service-cfg/files/um-service-config.sh index 9889c29..f38f148 100644 --- a/recipes-user-module/um-service-cfg/files/um-service-config.sh +++ b/recipes-user-module/um-service-cfg/files/um-service-config.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash UM_CONFIG_PATH=/etc/user-module UM_CONFIG_FILE=network.conf @@ -37,16 +37,22 @@ done source $UM_CONFIG -max_retry=30 +max_retry=15 counter=0 until [[ counter -ge $max_retry ]] do echo "Probing um. #$counter" ping -qc 1 -W 1 $USER_MODULE_ipv4_addr && break + sleep 1 ((counter++)) done +if ! ping -qc 1 -W 1 $USER_MODULE_ipv4_addr +then + echo "UM not reachable" + exit 1 +fi # Decide which config to load depending on the sw revision if `nc -z $USER_MODULE_ipv4_addr 7000` ; then