Skip to content
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* If not stated otherwise in this file or this component's Licenses.txt file the

Check failure on line 2 in source/scripts/init/src/apply_system_defaults/apply_system_defaults.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'BSD-3-Clause' license found in local file 'source/scripts/init/src/apply_system_defaults/apply_system_defaults.c' (Match: rdkb/components/opensource/ccsp/Utopia/rdkb/components/opensource/ccsp/Utopia/1904, 3426 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/Utopia/+archive/rdk-dev-1904.tar.gz, file: source/scripts/init/src/apply_system_defaults/apply_system_defaults.c)

Check failure on line 2 in source/scripts/init/src/apply_system_defaults/apply_system_defaults.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'BSD-Intel' license found in local file 'source/scripts/init/src/apply_system_defaults/apply_system_defaults.c' (Match: rdkb/components/opensource/ccsp/Utopia/rdkb/components/opensource/ccsp/Utopia/1, 3534 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/Utopia/+archive/RDKB-TEST-RELEASE-1.tar.gz, file: source/scripts/init/src/apply_system_defaults/apply_system_defaults.c)

Check failure on line 2 in source/scripts/init/src/apply_system_defaults/apply_system_defaults.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'BSD-Intel' license found in local file 'source/scripts/init/src/apply_system_defaults/apply_system_defaults.c' (Match: rdkb/components/opensource/ccsp/Utopia/rdkb/components/opensource/ccsp/Utopia/1, 3534 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/Utopia/+archive/RDKB-RELEASE-TEST-DUNFELL-1.tar.gz, file: source/scripts/init/src/apply_system_defaults/apply_system_defaults.c)

Check failure on line 2 in source/scripts/init/src/apply_system_defaults/apply_system_defaults.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'BSD-Intel' license found in local file 'source/scripts/init/src/apply_system_defaults/apply_system_defaults.c' (Match: rdkb/components/opensource/ccsp/Utopia/rdkb/components/opensource/ccsp/Utopia/2, 3534 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/Utopia/+archive/RDKB-RELEASE-TEST-DUNFELL-2.tar.gz, file: source/scripts/init/src/apply_system_defaults/apply_system_defaults.c)
* following copyright and licenses apply:
*
* Copyright 2015 RDK Management
Expand Down Expand Up @@ -72,6 +72,11 @@
#define PARTNER_DEFAULT_MIGRATE_PSM "/tmp/.apply_partner_defaults_psm"
#define PARTNER_DEFAULT_MIGRATE_FOR_NEW_PSM_MEMBER "/tmp/.apply_partner_defaults_new_psm_member"

#if defined(_ONESTACK_PRODUCT_REQ_)
#define BUSINESS_MODE_FILE "/nvram/.business-mode"
#define SETSTACKMODE_INIT_FLAG "/nvram/.setstackmode_intialize"
#endif

#define PARTNER_ID_LEN 64

#ifndef UNIT_TEST_DOCKER_SUPPORT
Expand Down Expand Up @@ -2376,6 +2381,14 @@
APPLY_PRINT("%s - Deletion of %s file handled in PSM init \n", __FUNCTION__, PARTNER_DEFAULT_APPLY_FILE );
//Delete at PSM init
//system( "rm -rf /nvram/.apply_partner_defaults" );
#if defined(_ONESTACK_PRODUCT_REQ_)
// Partner defaults being applied (partner change) - need to reconfigure stackmode
if (access(SETSTACKMODE_INIT_FLAG, F_OK) == 0)
{
unlink(SETSTACKMODE_INIT_FLAG);
APPLY_PRINT("%s - Deleted %s to force stackmode reconfiguration\n", __FUNCTION__, SETSTACKMODE_INIT_FLAG);
}
#endif
}

if ( access( PARTNER_DEFAULT_MIGRATE_PSM , F_OK ) == 0 )
Expand Down Expand Up @@ -3529,6 +3542,36 @@
APPLY_PRINT("%s - Failed to apply_value_to_sysevent block into sysevent for '%s'\n", __FUNCTION__, PartnerID);
}

#if defined(_ONESTACK_PRODUCT_REQ_)
// Set stackmode based on business-mode marker file
if (access(BUSINESS_MODE_FILE, F_OK) == 0)
{
// Business mode marker file exists, set to business mode
if (syscfg_set(NULL, "stackmode", "business") == 0)
{
syscfg_commit();
APPLY_PRINT("%s - Set stackmode to business (marker file present)\n", __FUNCTION__);
}
else
{
APPLY_PRINT("%s - Failed to set stackmode to business\n", __FUNCTION__);
}
}
else
{
// No business mode marker file, set to residential mode
if (syscfg_set(NULL, "stackmode", "residential") == 0)
{
syscfg_commit();
APPLY_PRINT("%s - Set stackmode to residential (no marker file)\n", __FUNCTION__);
}
else
{
APPLY_PRINT("%s - Failed to set stackmode to residential\n", __FUNCTION__);
}
}
Comment on lines 3560 to 3572
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

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

The marker file is only deleted in the commercial mode path (line 3547), but there's no deletion attempt in the residential mode path. If the intention is to use the marker file as a persistent indicator, this inconsistency could cause issues. If the marker file should be ephemeral and only used once, the residential path should also attempt to delete it (though it won't exist in that case, the code would be more symmetric). Alternatively, if the marker file is meant to persist, the comment on line 3546 stating "Delete the marker file after successfully setting syscfg" suggests it should be deleted, but this behavior is inconsistent.

Copilot uses AI. Check for mistakes.
#endif

sysevent_close(global_fd, global_id);

return(0);
Expand Down
21 changes: 21 additions & 0 deletions source/scripts/init/system/utopia_init_xb6.sh
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,27 @@ CheckAndReCreateDB()
fi
}

# Call setstackmode binary to set stackmode marker (with optimization)
if [ -x /usr/bin/setstackmode ]; then
SETSTACKMODE_INIT_FLAG="/nvram/.setstackmode_intialize"

# Optimization: Check if initialization flag exists
if [ -f "$SETSTACKMODE_INIT_FLAG" ]; then
echo "[utopia][init] setstackmode already initialized, skipping binary execution"
else
echo "[utopia][init] Calling setstackmode binary to configure stack mode"
/usr/bin/setstackmode
ret=$?
if [ $ret -eq 0 ]; then
echo "[utopia][init] setstackmode binary executed successfully (return code: $ret)"
else
echo "[utopia][init] setstackmode binary failed with return code: $ret"
fi
fi
else
echo "[utopia][init] setstackmode binary not found, skipping stack mode configuration"
fi

echo "[utopia][init] Starting syscfg using file store ($SYSCFG_NEW_FILE)"
if [ -f $SYSCFG_NEW_FILE ]; then
# Check and remove immutable attribute on syscfg.db if set
Expand Down
Loading