From 54e3d22a12c4d83781f96eef555e2e8e55d87341 Mon Sep 17 00:00:00 2001 From: Balaji Punnuru Date: Tue, 14 Oct 2025 11:50:22 -0400 Subject: [PATCH 1/5] RDKEMW-4148: Added support for copying credentials to secure location. Signed-off-by: Balaji Punnuru --- lib/rdk/NM_Bootstrap.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/rdk/NM_Bootstrap.sh b/lib/rdk/NM_Bootstrap.sh index 149e199c..155275c2 100644 --- a/lib/rdk/NM_Bootstrap.sh +++ b/lib/rdk/NM_Bootstrap.sh @@ -25,8 +25,9 @@ if [ "$RDK_PROFILE" == "TV" ]; then echo "`/bin/timestamp` :$0: Not migrating Wifi credentials for TVs from NM_Bootsrtap" >> /opt/logs/NMMonitor.log if [ -f $RDKV_SUPP_CONF ]; then sed -i '/network={/,/}/d' /opt/secure/wifi/wpa_supplicant.conf + rm -rf /opt/NetworkManager/system-connections/* + rm -rf /opt/secure/NetworkManager/system-connections/* fi - rm -rf /opt/NetworkManager/system-connections/* exit 0 fi @@ -47,10 +48,20 @@ if [ -f $RDKV_SUPP_CONF ]; then else PSK="" fi + sed -i '/network={/,/}/d' /opt/secure/wifi/wpa_supplicant.conf +else + file=`ls /opt/NetworkManager/system-connections/` + file_name="/opt/NetworkManager/system-connections/$file" + if [ -f $file_name ]; then + SSID=`grep "ssid=" $file_name | cut -d "=" -f 2` + PSK=`grep "psk=" $file_name | cut -d "=" -f 2` + rm -f $file_name + fi +fi - if [ -z $SSID ]; then +if [ -z $SSID ]; then echo "`/bin/timestamp` :$0: No SSID found in supplicant conf" >> /opt/logs/NMMonitor.log - else +else rm -rf /opt/NetworkManager/system-connections/* if [ -z $PSK ]; then #connect to wifi @@ -61,6 +72,4 @@ if [ -f $RDKV_SUPP_CONF ]; then nmcli conn add type wifi con-name "$SSID" autoconnect yes ifname wlan0 ssid "$SSID" wifi-sec.key-mgmt wpa-psk wifi-sec.psk "$PSK" nmcli conn reload fi - fi - sed -i '/network={/,/}/d' /opt/secure/wifi/wpa_supplicant.conf fi From c569e73d84579b05c9e066c8eb8c2df8615f5d03 Mon Sep 17 00:00:00 2001 From: Balaji Punnuru Date: Wed, 15 Oct 2025 10:53:22 -0400 Subject: [PATCH 2/5] RDKEMW-4148: Fixed runtime issues. Signed-off-by: Balaji Punnuru --- lib/rdk/NM_Bootstrap.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/rdk/NM_Bootstrap.sh b/lib/rdk/NM_Bootstrap.sh index 155275c2..3a616089 100644 --- a/lib/rdk/NM_Bootstrap.sh +++ b/lib/rdk/NM_Bootstrap.sh @@ -49,7 +49,8 @@ if [ -f $RDKV_SUPP_CONF ]; then PSK="" fi sed -i '/network={/,/}/d' /opt/secure/wifi/wpa_supplicant.conf -else +fi +if [ -z $SSID ]; then file=`ls /opt/NetworkManager/system-connections/` file_name="/opt/NetworkManager/system-connections/$file" if [ -f $file_name ]; then From 0cd51a39030dbf639051450484694cd852399d98 Mon Sep 17 00:00:00 2001 From: Balaji Punnuru Date: Wed, 15 Oct 2025 14:42:21 -0400 Subject: [PATCH 3/5] RDKEMW-4148: Fixed use case with mulitple files. Signed-off-by: Balaji Punnuru --- lib/rdk/NM_Bootstrap.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/rdk/NM_Bootstrap.sh b/lib/rdk/NM_Bootstrap.sh index 3a616089..2f9e27a8 100644 --- a/lib/rdk/NM_Bootstrap.sh +++ b/lib/rdk/NM_Bootstrap.sh @@ -51,13 +51,15 @@ if [ -f $RDKV_SUPP_CONF ]; then sed -i '/network={/,/}/d' /opt/secure/wifi/wpa_supplicant.conf fi if [ -z $SSID ]; then - file=`ls /opt/NetworkManager/system-connections/` - file_name="/opt/NetworkManager/system-connections/$file" - if [ -f $file_name ]; then - SSID=`grep "ssid=" $file_name | cut -d "=" -f 2` - PSK=`grep "psk=" $file_name | cut -d "=" -f 2` - rm -f $file_name - fi + for file in `ls /opt/NetworkManager/system-connections/` + do + file_name="/opt/NetworkManager/system-connections/$file" + if [ -f $file_name ]; then + SSID=`grep "ssid=" $file_name | cut -d "=" -f 2` + PSK=`grep "psk=" $file_name | cut -d "=" -f 2` + rm -f $file_name + fi + done fi if [ -z $SSID ]; then From 4abce8c6b3ca254dd7eeac20a79ede251c64a356 Mon Sep 17 00:00:00 2001 From: Balaji Punnuru Date: Wed, 15 Oct 2025 17:43:01 -0400 Subject: [PATCH 4/5] RDKEMW-4148: Fixed with reloading connection with previously configured settings. Signed-off-by: Balaji Punnuru --- lib/rdk/NM_Bootstrap.sh | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/lib/rdk/NM_Bootstrap.sh b/lib/rdk/NM_Bootstrap.sh index 2f9e27a8..dbe3a450 100644 --- a/lib/rdk/NM_Bootstrap.sh +++ b/lib/rdk/NM_Bootstrap.sh @@ -50,20 +50,13 @@ if [ -f $RDKV_SUPP_CONF ]; then fi sed -i '/network={/,/}/d' /opt/secure/wifi/wpa_supplicant.conf fi -if [ -z $SSID ]; then - for file in `ls /opt/NetworkManager/system-connections/` - do - file_name="/opt/NetworkManager/system-connections/$file" - if [ -f $file_name ]; then - SSID=`grep "ssid=" $file_name | cut -d "=" -f 2` - PSK=`grep "psk=" $file_name | cut -d "=" -f 2` - rm -f $file_name - fi - done -fi if [ -z $SSID ]; then echo "`/bin/timestamp` :$0: No SSID found in supplicant conf" >> /opt/logs/NMMonitor.log + echo "`/bin/timestamp` :$0: Trying with previously configured settings" >> /opt/logs/NMMonitor.log + cp /opt/NetworkManager/system-connections/* /opt/secure/NetworkManager/system-connections/ + rm -rf /opt/NetworkManager/system-connections/* + nmcli conn reload else rm -rf /opt/NetworkManager/system-connections/* if [ -z $PSK ]; then From fba64f140962b77f11538e13876a6bb8c167ada5 Mon Sep 17 00:00:00 2001 From: Balaji Punnuru Date: Thu, 16 Oct 2025 11:30:38 -0400 Subject: [PATCH 5/5] RDKEMW-4148: Fixed issue with XUMO Tv Build. Signed-off-by: Balaji Punnuru --- lib/rdk/NM_Bootstrap.sh | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/lib/rdk/NM_Bootstrap.sh b/lib/rdk/NM_Bootstrap.sh index dbe3a450..1577a0e7 100644 --- a/lib/rdk/NM_Bootstrap.sh +++ b/lib/rdk/NM_Bootstrap.sh @@ -21,15 +21,6 @@ RDK_PROFILE=$(grep "RDK_PROFILE" /etc/device.properties | cut -d '=' -f 2) RDKV_SUPP_CONF="/opt/secure/wifi/wpa_supplicant.conf" -if [ "$RDK_PROFILE" == "TV" ]; then - echo "`/bin/timestamp` :$0: Not migrating Wifi credentials for TVs from NM_Bootsrtap" >> /opt/logs/NMMonitor.log - if [ -f $RDKV_SUPP_CONF ]; then - sed -i '/network={/,/}/d' /opt/secure/wifi/wpa_supplicant.conf - rm -rf /opt/NetworkManager/system-connections/* - rm -rf /opt/secure/NetworkManager/system-connections/* - fi - exit 0 -fi if [ -f $RDKV_SUPP_CONF ]; then @@ -54,11 +45,25 @@ fi if [ -z $SSID ]; then echo "`/bin/timestamp` :$0: No SSID found in supplicant conf" >> /opt/logs/NMMonitor.log echo "`/bin/timestamp` :$0: Trying with previously configured settings" >> /opt/logs/NMMonitor.log - cp /opt/NetworkManager/system-connections/* /opt/secure/NetworkManager/system-connections/ - rm -rf /opt/NetworkManager/system-connections/* + if [ ! -d /opt/secure/NetworkManager/system-connections ]; then + mkdir -p /opt/secure/NetworkManager/system-connections + fi + if [ -d /opt/NetworkManager/system-connections ]; then + cp /opt/NetworkManager/system-connections/* /opt/secure/NetworkManager/system-connections/ + rm -rf /opt/NetworkManager/system-connections/* + fi nmcli conn reload else - rm -rf /opt/NetworkManager/system-connections/* + if [ -d /opt/NetworkManager/system-connections ]; then + rm -rf /opt/NetworkManager/system-connections/* + fi + if [ "$RDK_PROFILE" == "TV" ]; then + echo "`/bin/timestamp` :$0: Not migrating Wifi credentials for TVs from NM_Bootsrtap" >> /opt/logs/NMMonitor.log + if [ -d /opt/secure/NetworkManager/system-connections ]; then + rm -rf /opt/secure/NetworkManager/system-connections/* + fi + exit 0 + fi if [ -z $PSK ]; then #connect to wifi nmcli conn add type wifi con-name "$SSID" autoconnect yes ifname wlan0 ssid "$SSID"