User Tools

Site Tools


Sidebar

Translations of this page:

Contacts Us

  • Contact Us

en:stb_webkit:faq:checking_variables_at_boot

Checking of variables at the portal start

If the variables differ then it is necessary to set the correct variables.

Example of checking portal1 and portal2 variables. Example is for 0.2.14-r7.

  • Add in /home/web/index.html:
// **********************************************************************
function check_portal_vars(){
    var arr = [
 '',
 ''
 ];
 //portal_1 portal_2 use_portal_dhcp portal_dhcp
    var real_arr = [
        {"value":getEnvironmentValue('portal1'),"variable":"portal1"},
        {"value":getEnvironmentValue('portal2'),"variable":"portal2"}
    ];
    for(var i = 0;i<4;i++){
        if(real_arr[i].value != arr[i]){
            if(arr[i] != 'no_matter'){
                setEnvironmentValue(real_arr[i].variable,arr[i]);
            }
        }       
    }
}
// **********************************************************************
  • Add in /home/web/index.html: after player will initialized
// **********************************************************************
check_portal_vars();
// **********************************************************************

Example of index.html

  • Add in test.sh:
// **********************************************************************
    PORTAL_1=`fw_printenv portal1 2>/dev/null`
    PORTAL_1=${PORTAL_1#portal1=}
 
if [ "$PORTAL_1" != "" ]
 
 
then
    fw_setenv portal1
    PORTAL_1=
fi
 
    PORTAL_2=`fw_printenv portal2 2>/dev/null`
    PORTAL_2=${PORTAL_2#portal2=}
 
if [ "$PORTAL_2" != "" ]
 
 
then
    fw_setenv portal2
    PORTAL_2=
fi
// **********************************************************************

Example of test.sh

en/stb_webkit/faq/checking_variables_at_boot.txt · Last modified: 2021/02/01 14:33 (external edit)