From 62dbd1eef40f3d8b6347f4b5519416b4e6750b40 Mon Sep 17 00:00:00 2001 From: Aravindan NC <35158113+AravindanNC@users.noreply.github.com> Date: Wed, 8 Oct 2025 16:46:11 -0400 Subject: [PATCH 1/8] RDKEMW-9104: Enhance NM_Bootstrap.sh for RDKE migration --- lib/rdk/NM_Bootstrap.sh | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/lib/rdk/NM_Bootstrap.sh b/lib/rdk/NM_Bootstrap.sh index 1d930133..600da3ad 100644 --- a/lib/rdk/NM_Bootstrap.sh +++ b/lib/rdk/NM_Bootstrap.sh @@ -19,11 +19,18 @@ # limitations under the License. ############################################################################## -WIFI_WPA_SUPPLICANT_CONF="/opt/secure/wifi/wpa_supplicant.conf" - -if [ -f $WIFI_WPA_SUPPLICANT_CONF ]; then - SSID=$(cat $WIFI_WPA_SUPPLICANT_CONF | grep -w ssid= | cut -d '"' -f 2) - PSK_LINE=$(grep psk= "$WIFI_WPA_SUPPLICANT_CONF") +RDKV_SUPP_CONF="/opt/secure/wifi/wpa_supplicant.conf" +if [ -f $RDKV_SUPP_CONF ]; then + if [ -f "/opt/secure/migration/migration_data_store.json" ]; then + bootType=$(cat /tmp/boottype) + bootMigration="BOOT_MIGRATION" + if [ "$bootType" == "$bootMigration" ]; then + rm -f $RDKV_SUPP_CONF + exit 0 + fi + fi + SSID=$(cat $RDKV_SUPP_CONF | grep -w ssid= | cut -d '"' -f 2) + PSK_LINE=$(grep psk= "$RDKV_SUPP_CONF") # Case 1: Quoted passphrase if [[ "$PSK_LINE" =~ psk=\"(.+)\" ]]; then @@ -37,6 +44,20 @@ if [ -f $WIFI_WPA_SUPPLICANT_CONF ]; then else PSK="" fi - echo "`/bin/timestamp` :$0: Removed nmcli SSID connect" >> /opt/logs/NMMonitor.log - sed -i '/network={/,/}/d' /opt/secure/wifi/wpa_supplicant.conf + + if [ -z $SSID ]; then + echo "`/bin/timestamp` :$0: No SSID found in supplicant conf" >> /opt/logs/NMMonitor.log + else + rm -rf /opt/NetworkManager/system-connections/* + if [ -z $PSK ]; then + #connect to wifi + nmcli conn add type wifi con-name "$SSID" autoconnect yes ifname wlan0 ssid "$SSID" + nmcli conn reload + else + #connect to wifi + 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 + rm -f $RDKV_SUPP_CONF fi From b611e38d76289706a97d027fe650a09564e07772 Mon Sep 17 00:00:00 2001 From: Aravindan NC <35158113+AravindanNC@users.noreply.github.com> Date: Wed, 8 Oct 2025 16:46:46 -0400 Subject: [PATCH 2/8] RDKEMW-9104: Enhance NM_Bootstrap.sh for RDKE migration --- systemd_units/NetworkManager_ecfs.conf | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 systemd_units/NetworkManager_ecfs.conf diff --git a/systemd_units/NetworkManager_ecfs.conf b/systemd_units/NetworkManager_ecfs.conf new file mode 100644 index 00000000..312b8901 --- /dev/null +++ b/systemd_units/NetworkManager_ecfs.conf @@ -0,0 +1,2 @@ +[Unit] +After=ecfs-init.service From 4a41268ec078673358cd10c4da0fc9f7a0ab4ab2 Mon Sep 17 00:00:00 2001 From: Aravindan NC <35158113+AravindanNC@users.noreply.github.com> Date: Thu, 9 Oct 2025 08:48:02 -0400 Subject: [PATCH 3/8] RDKEMW-9104: Enhance NM_Bootstrap.sh for RDKE migration --- systemd_units/NetworkManager_ecfs.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd_units/NetworkManager_ecfs.conf b/systemd_units/NetworkManager_ecfs.conf index 312b8901..dcf4079f 100644 --- a/systemd_units/NetworkManager_ecfs.conf +++ b/systemd_units/NetworkManager_ecfs.conf @@ -1,2 +1,2 @@ [Unit] -After=ecfs-init.service +After=securemount.service From 1787e35aa0758971c521d90539e88da73f90570c Mon Sep 17 00:00:00 2001 From: Aravindan NC <35158113+AravindanNC@users.noreply.github.com> Date: Thu, 9 Oct 2025 10:47:43 -0400 Subject: [PATCH 4/8] RDKEMW-9104: Enhance NM_Bootstrap.sh for RDKE migration --- systemd_units/NetworkManager_ecfs.conf | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 systemd_units/NetworkManager_ecfs.conf diff --git a/systemd_units/NetworkManager_ecfs.conf b/systemd_units/NetworkManager_ecfs.conf deleted file mode 100644 index dcf4079f..00000000 --- a/systemd_units/NetworkManager_ecfs.conf +++ /dev/null @@ -1,2 +0,0 @@ -[Unit] -After=securemount.service From 496358b37ae64fe02b386d661e73eb62cdb2c690 Mon Sep 17 00:00:00 2001 From: Aravindan NC <35158113+AravindanNC@users.noreply.github.com> Date: Thu, 9 Oct 2025 10:50:19 -0400 Subject: [PATCH 5/8] RDKEMW-9104: Enhance NM_Bootstrap.sh for RDKE migration --- lib/rdk/NM_Bootstrap.sh | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/lib/rdk/NM_Bootstrap.sh b/lib/rdk/NM_Bootstrap.sh index 600da3ad..70f33450 100644 --- a/lib/rdk/NM_Bootstrap.sh +++ b/lib/rdk/NM_Bootstrap.sh @@ -21,14 +21,7 @@ RDKV_SUPP_CONF="/opt/secure/wifi/wpa_supplicant.conf" if [ -f $RDKV_SUPP_CONF ]; then - if [ -f "/opt/secure/migration/migration_data_store.json" ]; then - bootType=$(cat /tmp/boottype) - bootMigration="BOOT_MIGRATION" - if [ "$bootType" == "$bootMigration" ]; then - rm -f $RDKV_SUPP_CONF - exit 0 - fi - fi + SSID=$(cat $RDKV_SUPP_CONF | grep -w ssid= | cut -d '"' -f 2) PSK_LINE=$(grep psk= "$RDKV_SUPP_CONF") From 2c9fbe74b433bee41e2da0eca53ff7130e51ba62 Mon Sep 17 00:00:00 2001 From: Aravindan NC <35158113+AravindanNC@users.noreply.github.com> Date: Thu, 9 Oct 2025 13:56:35 -0400 Subject: [PATCH 6/8] RDKEMW-9104: Enhance NM_Bootstrap.sh for RDKE migration --- lib/rdk/NM_Bootstrap.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/rdk/NM_Bootstrap.sh b/lib/rdk/NM_Bootstrap.sh index 70f33450..42cb9b40 100644 --- a/lib/rdk/NM_Bootstrap.sh +++ b/lib/rdk/NM_Bootstrap.sh @@ -19,9 +19,18 @@ # limitations under the License. ############################################################################## +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 + fi + exit 0 +fi + + if [ -f $RDKV_SUPP_CONF ]; then - SSID=$(cat $RDKV_SUPP_CONF | grep -w ssid= | cut -d '"' -f 2) PSK_LINE=$(grep psk= "$RDKV_SUPP_CONF") @@ -52,5 +61,5 @@ if [ -f $RDKV_SUPP_CONF ]; then nmcli conn reload fi fi - rm -f $RDKV_SUPP_CONF + sed -i '/network={/,/}/d' /opt/secure/wifi/wpa_supplicant.conf fi From ac5478a28ad2b57ed97f2244d5068df135b15b1f Mon Sep 17 00:00:00 2001 From: Aravindan NC <35158113+AravindanNC@users.noreply.github.com> Date: Thu, 9 Oct 2025 13:56:59 -0400 Subject: [PATCH 7/8] RDKEMW-9104: Enhance NM_Bootstrap.sh for RDKE migration --- systemd_units/NetworkManager_ecfs.conf | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 systemd_units/NetworkManager_ecfs.conf diff --git a/systemd_units/NetworkManager_ecfs.conf b/systemd_units/NetworkManager_ecfs.conf new file mode 100644 index 00000000..dcf4079f --- /dev/null +++ b/systemd_units/NetworkManager_ecfs.conf @@ -0,0 +1,2 @@ +[Unit] +After=securemount.service From fa324eea9c030e7df466819b6a4f25b6a377b11c Mon Sep 17 00:00:00 2001 From: Aravindan NC <35158113+AravindanNC@users.noreply.github.com> Date: Thu, 9 Oct 2025 14:50:05 -0400 Subject: [PATCH 8/8] Update NM_Bootstrap.sh --- lib/rdk/NM_Bootstrap.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/rdk/NM_Bootstrap.sh b/lib/rdk/NM_Bootstrap.sh index 42cb9b40..149e199c 100644 --- a/lib/rdk/NM_Bootstrap.sh +++ b/lib/rdk/NM_Bootstrap.sh @@ -26,6 +26,7 @@ if [ "$RDK_PROFILE" == "TV" ]; then if [ -f $RDKV_SUPP_CONF ]; then sed -i '/network={/,/}/d' /opt/secure/wifi/wpa_supplicant.conf fi + rm -rf /opt/NetworkManager/system-connections/* exit 0 fi