Skip to content

Conversation

@NareshM1702
Copy link
Contributor

@NareshM1702 NareshM1702 commented Feb 9, 2026

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

@NareshM1702 NareshM1702 requested review from a team as code owners February 9, 2026 06:27
Copilot AI review requested due to automatic review settings February 9, 2026 06:27
Copy link
Contributor

Copilot AI left a 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_migrate gating logic to run the migration only once after upgrade.
  • If migration hasn’t run yet, set DeviceType to PROD and 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.

Comment on lines +214 to +221
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
Copy link

Copilot AI Feb 9, 2026

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.

Copilot uses AI. Check for mistakes.
echo "SSH: Forward SSH changed to disabled" >> $Log_file
fi

#Change devicetype on firmware udgrade
Copy link

Copilot AI Feb 9, 2026

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).

Suggested change
#Change devicetype on firmware udgrade
# Change device type on firmware upgrade

Copilot uses AI. Check for mistakes.
Comment on lines 413 to 417
DEVICETYPE_MIGRATE="$(syscfg get devicetype_migrate)"
echo "$DEVICETYPE_MIGRATE"
if [ -z "$DEVICETYPE_MIGRATE" ]; then
CURRENT_DEVICETYPE="$(syscfg get DeviceType)"
echo "$CURRENT_DEVICETYPE"
Copy link

Copilot AI Feb 9, 2026

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.

Copilot uses AI. Check for mistakes.
Comment on lines +419 to +426
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
Copy link

Copilot AI Feb 9, 2026

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.

Copilot uses AI. Check for mistakes.
syscfg commit
fi

#Change devicetype on firmware udgrade
Copy link

Copilot AI Feb 9, 2026

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).

Suggested change
#Change devicetype on firmware udgrade
# Change device type on firmware upgrade

Copilot uses AI. Check for mistakes.
Comment on lines 208 to 212
DEVICETYPE_MIGRATE="$(syscfg get devicetype_migrate)"
echo "$DEVICETYPE_MIGRATE"
if [ -z "$DEVICETYPE_MIGRATE" ]; then
CURRENT_DEVICETYPE="$(syscfg get DeviceType)"
echo "$CURRENT_DEVICETYPE"
Copy link

Copilot AI Feb 9, 2026

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] ...").

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings February 12, 2026 05:57
Copy link
Contributor

Copilot AI left a 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
Copy link

Copilot AI Feb 12, 2026

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".

Suggested change
#Change devicetype on firmware udgrade
#Change devicetype on firmware upgrade

Copilot uses AI. Check for mistakes.
Comment on lines 414 to 417
echo "$DEVICETYPE_MIGRATE"
if [ -z "$DEVICETYPE_MIGRATE" ]; then
CURRENT_DEVICETYPE="$(syscfg get DeviceType)"
echo "$CURRENT_DEVICETYPE"
Copy link

Copilot AI Feb 12, 2026

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).

Suggested change
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"

Copilot uses AI. Check for mistakes.
Comment on lines +420 to +426
syscfg set DeviceType "PROD"
syscfg commit
else
echo "DeviceType is already PROD, no change needed"
fi
syscfg set devicetype_migrate "1"
syscfg commit
Copy link

Copilot AI Feb 12, 2026

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.

Suggested change
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

Copilot uses AI. Check for mistakes.
syscfg commit
fi

#Change devicetype on firmware udgrade
Copy link

Copilot AI Feb 12, 2026

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".

Suggested change
#Change devicetype on firmware udgrade
#Change devicetype on firmware upgrade

Copilot uses AI. Check for mistakes.
Comment on lines 209 to 212
echo "$DEVICETYPE_MIGRATE"
if [ -z "$DEVICETYPE_MIGRATE" ]; then
CURRENT_DEVICETYPE="$(syscfg get DeviceType)"
echo "$CURRENT_DEVICETYPE"
Copy link

Copilot AI Feb 12, 2026

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]).

Suggested change
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"

Copilot uses AI. Check for mistakes.
Comment on lines +215 to +221
syscfg set DeviceType "PROD"
syscfg commit
else
echo "DeviceType is already PROD, no change needed"
fi
syscfg set devicetype_migrate "1"
syscfg commit
Copy link

Copilot AI Feb 12, 2026

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.

Suggested change
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

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings February 12, 2026 06:19
Copy link
Contributor

Copilot AI left a 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"
Copy link

Copilot AI Feb 12, 2026

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.

Suggested change
echo "$DEVICETYPE_MIGRATE"

Copilot uses AI. Check for mistakes.
Comment on lines +212 to +215
echo "[utopia] Devicetype is $CURRENT_DEVICETYPE"
if [ "$CURRENT_DEVICETYPE" != "PROD" ]; then
echo "setting DeviceType to PROD"
syscfg set DeviceType "PROD"
Copy link

Copilot AI Feb 12, 2026

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.

Copilot uses AI. Check for mistakes.
Comment on lines +417 to +420
echo "[Utopia] Devicetype is $CURRENT_DEVICETYPE"
if [ "$CURRENT_DEVICETYPE" != "PROD" ]; then
echo "setting DeviceType to PROD"
syscfg set DeviceType "PROD"
Copy link

Copilot AI Feb 12, 2026

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.

Copilot uses AI. Check for mistakes.

#Change devicetype on firmware udgrade
DEVICETYPE_MIGRATE="$(syscfg get devicetype_migrate)"
echo "$DEVICETYPE_MIGRATE"
Copy link

Copilot AI Feb 12, 2026

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.

Suggested change
echo "$DEVICETYPE_MIGRATE"

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant