function wrk_setHwPlatform($db) { $arch = wrk_getHwPlatform(); $playerid = wrk_playerID($arch); // register playerID into database playerSession('write', $db, 'playerid', $playerid); // register platform into database switch ($arch) { case '01': playerSession('write', $db, 'hwplatform', 'RaspberryPi'); playerSession('write', $db, 'hwplatformid', $arch); break; case '02': playerSession('write', $db, 'hwplatform', 'UDOO'); playerSession('write', $db, 'hwplatformid', $arch); break; case '03': playerSession('write', $db, 'hwplatform', 'CuBox'); playerSession('write', $db, 'hwplatformid', $arch); break; case '04': playerSession('write', $db, 'hwplatform', 'BeagleBone Black'); playerSession('write', $db, 'hwplatformid', $arch); break; default: playerSession('write', $db, 'hwplatform', 'unknown'); playerSession('write', $db, 'hwplatformid', $arch); } }
// change /run and session files for correct session file locking sysCmd('chmod 777 /run'); // reset DB permission sysCmd('chmod -R 777 /var/www/db'); // initialize CLI session session_save_path('/run'); // inpect session playerSession('open', $db, '', ''); // reset session file permissions sysCmd('chmod 777 /run/sess*'); // mount all sources wrk_sourcemount($db, 'mountall'); // start MPD daemon sysCmd("service mpd start"); // check Architecture $arch = wrk_getHwPlatform(); if ($arch != $_SESSION['hwplatformid']) { // reset playerID if architectureID not match. This condition "fire" another first-install process playerSession('write', $db, 'playerid', ''); } // --- INITIALIZE ENVIRONMENT --- // // --- PLAYER FIRST INSTALLATION PROCESS --- // if (isset($_SESSION['playerid']) && $_SESSION['playerid'] == '') { // register HW architectureID and playerID wrk_setHwPlatform($db); // destroy actual session playerSession('destroy', $db, '', ''); // reload session data playerSession('open', $db, '', ''); // reset ENV parameters wrk_sysChmod();
function wrk_setHwPlatform($db) { $arch = wrk_getHwPlatform(); $playerid = wrk_playerID($arch); // register playerID into database playerSession('write', $db, 'playerid', $playerid); // register platform into database switch ($arch) { case '01': playerSession('write', $db, 'hwplatform', 'RaspberryPi'); playerSession('write', $db, 'hwplatformid', $arch); break; case '02': playerSession('write', $db, 'hwplatform', 'UDOO'); playerSession('write', $db, 'hwplatformid', $arch); break; case '03': playerSession('write', $db, 'hwplatform', 'CuBox'); playerSession('write', $db, 'hwplatformid', $arch); break; case '04': playerSession('write', $db, 'hwplatform', 'BeagleBone Black'); playerSession('write', $db, 'hwplatformid', $arch); break; case '05': playerSession('write', $db, 'hwplatform', 'Compulab Utilite'); playerSession('write', $db, 'hwplatformid', $arch); break; case '06': playerSession('write', $db, 'hwplatform', 'Wandboard'); playerSession('write', $db, 'hwplatformid', $arch); break; case '07': playerSession('write', $db, 'hwplatform', 'Cubieboard'); playerSession('write', $db, 'hwplatformid', $arch); break; case '08': playerSession('write', $db, 'hwplatform', 'RaspberryPi2'); playerSession('write', $db, 'hwplatformid', $arch); break; case '09': playerSession('write', $db, 'hwplatform', 'Odroid-C1'); playerSession('write', $db, 'hwplatformid', $arch); break; default: playerSession('write', $db, 'hwplatform', 'unknown'); playerSession('write', $db, 'hwplatformid', $arch); } }
$arch = wrk_getHwPlatform($foo); if ($arch != $_SESSION['hwplatformid']) { // reset playerID if architectureID not match. This condition "fire" another first-install process Session::update('playerid', ''); } }, true); /* * First-time installation */ if ($opt_install || isset($_SESSION['playerid']) && $_SESSION['playerid'] == '') { logWorker('[daemon] First-time installation'); // re-init session Session::wrap(function () { Session::destroy(); // get architecture $arch = wrk_getHwPlatform($archName); // register playerID into database Session::update('playerid', wrk_playerID($arch)); // register platform into database Session::update('hwplatformid', $arch); Session::update('hwplatform', $archName); }, true); // reset ENV parameters wrk_sysChmod(); // reset netconf to defaults ConfigDB::update('cfg_wifisec', '', array('ssid' => '', 'encryption' => '', 'password' => '')); $netconf = <<<EOD auto lo iface lo inet loopback auto eth0
function wrk_setHwPlatform($redis) { $arch = wrk_getHwPlatform(); runelog('arch= ', $arch); $playerid = wrk_playerID($arch); $redis->set('playerid', $playerid); runelog('playerid= ', $playerid); // register platform into database switch ($arch) { case '01': $redis->set('hwplatform', 'RaspberryPi'); $redis->set('hwplatformid', $arch); break; case '02': $redis->set('hwplatform', 'UDOO'); $redis->set('hwplatformid', $arch); break; case '03': $redis->set('hwplatform', 'CuBox'); $redis->set('hwplatformid', $arch); break; case '04': $redis->set('hwplatform', 'BeagleBone Black'); $redis->set('hwplatformid', $arch); break; case '05': $redis->set('hwplatform', 'Utilite Standard'); $redis->set('hwplatformid', $arch); break; case '06': $redis->set('hwplatform', 'Cubietruck'); $redis->set('hwplatformid', $arch); break; default: $redis->set('hwplatform', 'unknown'); $redis->set('hwplatformid', $arch); } }