Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions lib/rdk/NM_Bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -54,11 +45,26 @@ 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be moved inside the if - fi as thats where we do the connection settings moved.
Having it outside will lead to calling reload on every reboot.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed with Balaji and confirmed that this is not affecting the boot-up and having zero impact.. so leaving it as is; we can address it in develop properly

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block of script will not execute at all for TV platforms as the SSID will be ALWAYS empty.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed with Balaji and he mentioned that this is just to double-sure. Im okey with this change

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"
Expand Down