-
Notifications
You must be signed in to change notification settings - Fork 41
RDKB-63406:Devicetype RFC default value is not migrating after software upgrade #212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a one-time migration during boot to ensure the DeviceType syscfg value is set to PROD after a software/firmware upgrade (tracked via a new devicetype_migrate syscfg flag) for XB6 and HUB4 platforms.
Changes:
- Add
devicetype_migrategating logic to run the migration only once after upgrade. - If migration hasn’t run yet, set
DeviceTypetoPRODand persist the migration flag.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| source/scripts/init/system/utopia_init_xb6.sh | Adds one-time DeviceType migration logic gated by devicetype_migrate. |
| source/scripts/init/system/utopia_init_hub4.sh | Adds the same one-time DeviceType migration logic for HUB4. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| echo "setting DeviceType to PROD" | ||
| syscfg set DeviceType "PROD" | ||
| syscfg commit | ||
| else | ||
| echo "DeviceType is already PROD, no change needed" | ||
| fi | ||
| syscfg set devicetype_migrate "1" | ||
| syscfg commit |
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syscfg commit is called twice in this migration path (once after setting DeviceType and again after setting devicetype_migrate). Consider setting both keys first and committing once to reduce persistent storage writes during boot.
| echo "SSH: Forward SSH changed to disabled" >> $Log_file | ||
| fi | ||
|
|
||
| #Change devicetype on firmware udgrade |
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix typos in the new migration header comment (e.g., "udgrade" -> "upgrade" and consider "device type" for readability).
| #Change devicetype on firmware udgrade | |
| # Change device type on firmware upgrade |
| DEVICETYPE_MIGRATE="$(syscfg get devicetype_migrate)" | ||
| echo "$DEVICETYPE_MIGRATE" | ||
| if [ -z "$DEVICETYPE_MIGRATE" ]; then | ||
| CURRENT_DEVICETYPE="$(syscfg get DeviceType)" | ||
| echo "$CURRENT_DEVICETYPE" |
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The unconditional echo statements output raw syscfg values to stdout during init (including a blank line when unset). For XB6 this script already appends init/migration logs to $Log_file; consider removing these debug prints or logging with a consistent prefix and redirecting to the appropriate log file.
| echo "setting DeviceType to PROD" | ||
| syscfg set DeviceType "PROD" | ||
| syscfg commit | ||
| else | ||
| echo "DeviceType is already PROD, no change needed" | ||
| fi | ||
| syscfg set devicetype_migrate "1" | ||
| syscfg commit |
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syscfg commit is called twice in this migration path (once after setting DeviceType and again after setting devicetype_migrate). To reduce flash/NVRAM writes, set both keys first and commit once at the end of the block.
| syscfg commit | ||
| fi | ||
|
|
||
| #Change devicetype on firmware udgrade |
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix typos in the new migration header comment (e.g., "udgrade" -> "upgrade" and consider "device type" for readability).
| #Change devicetype on firmware udgrade | |
| # Change device type on firmware upgrade |
| DEVICETYPE_MIGRATE="$(syscfg get devicetype_migrate)" | ||
| echo "$DEVICETYPE_MIGRATE" | ||
| if [ -z "$DEVICETYPE_MIGRATE" ]; then | ||
| CURRENT_DEVICETYPE="$(syscfg get DeviceType)" | ||
| echo "$CURRENT_DEVICETYPE" |
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The unconditional echo statements print raw syscfg values to stdout during init (including a blank line when unset). Consider removing these debug prints or using the same tagged logging style used elsewhere in this script (e.g., echo "[utopia][init] ...").
8964ae6 to
9591b2c
Compare
9591b2c to
e941e3b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| echo "SSH: Forward SSH changed to disabled" >> $Log_file | ||
| fi | ||
|
|
||
| #Change devicetype on firmware udgrade |
Copilot
AI
Feb 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in comment: "udgrade" should be "upgrade".
| #Change devicetype on firmware udgrade | |
| #Change devicetype on firmware upgrade |
| echo "$DEVICETYPE_MIGRATE" | ||
| if [ -z "$DEVICETYPE_MIGRATE" ]; then | ||
| CURRENT_DEVICETYPE="$(syscfg get DeviceType)" | ||
| echo "$CURRENT_DEVICETYPE" |
Copilot
AI
Feb 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The two echo lines print raw syscfg values to stdout without any context/prefix, which can clutter boot logs and makes it hard to trace where the output came from. Consider removing these debug prints or logging with a consistent prefix (and/or redirecting to the existing $Log_file used in this section).
| echo "$DEVICETYPE_MIGRATE" | |
| if [ -z "$DEVICETYPE_MIGRATE" ]; then | |
| CURRENT_DEVICETYPE="$(syscfg get DeviceType)" | |
| echo "$CURRENT_DEVICETYPE" | |
| echo "[utopia][init] devicetype_migrate value: $DEVICETYPE_MIGRATE" >> "$Log_file" | |
| if [ -z "$DEVICETYPE_MIGRATE" ]; then | |
| CURRENT_DEVICETYPE="$(syscfg get DeviceType)" | |
| echo "[utopia][init] current DeviceType value: $CURRENT_DEVICETYPE" >> "$Log_file" |
| syscfg set DeviceType "PROD" | ||
| syscfg commit | ||
| else | ||
| echo "DeviceType is already PROD, no change needed" | ||
| fi | ||
| syscfg set devicetype_migrate "1" | ||
| syscfg commit |
Copilot
AI
Feb 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
devicetype_migrate is set unconditionally after the DeviceType update attempt. If syscfg set/commit for DeviceType fails for any reason, the migrate flag will still be written and the script won’t retry on the next boot. Consider setting both keys and doing a single syscfg commit, and only marking devicetype_migrate=1 after confirming the DeviceType change (and commit) succeeded.
| syscfg set DeviceType "PROD" | |
| syscfg commit | |
| else | |
| echo "DeviceType is already PROD, no change needed" | |
| fi | |
| syscfg set devicetype_migrate "1" | |
| syscfg commit | |
| if syscfg set DeviceType "PROD" && syscfg set devicetype_migrate "1" && syscfg commit; then | |
| echo "DeviceType successfully migrated to PROD and devicetype_migrate marked" | |
| else | |
| echo "Failed to migrate DeviceType to PROD; devicetype_migrate not marked (will retry on next boot)" | |
| fi | |
| else | |
| echo "DeviceType is already PROD, no change needed" | |
| if syscfg set devicetype_migrate "1" && syscfg commit; then | |
| echo "devicetype_migrate successfully marked with existing PROD DeviceType" | |
| else | |
| echo "Failed to mark devicetype_migrate with existing PROD DeviceType (will retry on next boot)" | |
| fi | |
| fi |
| syscfg commit | ||
| fi | ||
|
|
||
| #Change devicetype on firmware udgrade |
Copilot
AI
Feb 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in comment: "udgrade" should be "upgrade".
| #Change devicetype on firmware udgrade | |
| #Change devicetype on firmware upgrade |
| echo "$DEVICETYPE_MIGRATE" | ||
| if [ -z "$DEVICETYPE_MIGRATE" ]; then | ||
| CURRENT_DEVICETYPE="$(syscfg get DeviceType)" | ||
| echo "$CURRENT_DEVICETYPE" |
Copilot
AI
Feb 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The two echo lines print raw syscfg values to stdout without any context/prefix, which can clutter boot logs and makes it hard to trace where the output came from. Consider removing these debug prints or logging with a consistent prefix (e.g., [utopia][init]).
| echo "$DEVICETYPE_MIGRATE" | |
| if [ -z "$DEVICETYPE_MIGRATE" ]; then | |
| CURRENT_DEVICETYPE="$(syscfg get DeviceType)" | |
| echo "$CURRENT_DEVICETYPE" | |
| echo "[utopia][init] devicetype_migrate flag: $DEVICETYPE_MIGRATE" | |
| if [ -z "$DEVICETYPE_MIGRATE" ]; then | |
| CURRENT_DEVICETYPE="$(syscfg get DeviceType)" | |
| echo "[utopia][init] Current DeviceType: $CURRENT_DEVICETYPE" |
| syscfg set DeviceType "PROD" | ||
| syscfg commit | ||
| else | ||
| echo "DeviceType is already PROD, no change needed" | ||
| fi | ||
| syscfg set devicetype_migrate "1" | ||
| syscfg commit |
Copilot
AI
Feb 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
devicetype_migrate is set unconditionally after the DeviceType update attempt. If syscfg set/commit for DeviceType fails, the migrate flag will still be written and the script won’t retry on the next boot. Consider setting both keys and doing a single syscfg commit, and only marking devicetype_migrate=1 after confirming the DeviceType change (and commit) succeeded.
| syscfg set DeviceType "PROD" | |
| syscfg commit | |
| else | |
| echo "DeviceType is already PROD, no change needed" | |
| fi | |
| syscfg set devicetype_migrate "1" | |
| syscfg commit | |
| if syscfg set DeviceType "PROD" && syscfg set devicetype_migrate "1" && syscfg commit; then | |
| echo "DeviceType updated to PROD and devicetype_migrate set" | |
| else | |
| echo "Failed to update DeviceType to PROD; devicetype_migrate not set" >&2 | |
| fi | |
| else | |
| echo "DeviceType is already PROD, no change needed" | |
| if syscfg set devicetype_migrate "1" && syscfg commit; then | |
| echo "devicetype_migrate set for existing PROD DeviceType" | |
| else | |
| echo "Failed to set devicetype_migrate for existing PROD DeviceType" >&2 | |
| fi | |
| fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| #Change devicetype on firmware udgrade | ||
| DEVICETYPE_MIGRATE="$(syscfg get devicetype_migrate)" | ||
| echo "$DEVICETYPE_MIGRATE" |
Copilot
AI
Feb 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
echo "$DEVICETYPE_MIGRATE" looks like leftover debug output and will print an empty line (or "1") to the console/log on every boot. Consider removing it or replacing it with a prefixed message that only logs when a migration is performed.
| echo "$DEVICETYPE_MIGRATE" |
| echo "[utopia] Devicetype is $CURRENT_DEVICETYPE" | ||
| if [ "$CURRENT_DEVICETYPE" != "PROD" ]; then | ||
| echo "setting DeviceType to PROD" | ||
| syscfg set DeviceType "PROD" |
Copilot
AI
Feb 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logging tag/format is inconsistent with the rest of this script (nearby messages use "[utopia][init]"), but this block uses "[utopia]" and unprefixed echos. Please align the log prefix/format so migration logs are searchable and consistent.
| echo "[Utopia] Devicetype is $CURRENT_DEVICETYPE" | ||
| if [ "$CURRENT_DEVICETYPE" != "PROD" ]; then | ||
| echo "setting DeviceType to PROD" | ||
| syscfg set DeviceType "PROD" |
Copilot
AI
Feb 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logging tag is inconsistent with the rest of this script (nearby messages use "[utopia][init]"), but this block uses "[Utopia]" and unprefixed echos. Please align the log prefix/format so migration logs are searchable and consistent.
|
|
||
| #Change devicetype on firmware udgrade | ||
| DEVICETYPE_MIGRATE="$(syscfg get devicetype_migrate)" | ||
| echo "$DEVICETYPE_MIGRATE" |
Copilot
AI
Feb 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
echo "$DEVICETYPE_MIGRATE" looks like leftover debug output and will print an empty line (or "1") to the console/log on every boot. Consider removing it or replacing it with a prefixed message that only logs when a migration is performed.
| echo "$DEVICETYPE_MIGRATE" |
Reason for change:clearing shellcheck errors in utopia components
Test Procedure: build and flash the image verify the RFC is changing
Risks:Medium
Priority: P1