Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Unexpected error message popup: The image does not contain userid, etc.
#2
Here's the function in inc/common.php that would have assigned NO_USERID_DEFINED.  This will give you a way to determine which of the conditions may not have been met.

Code:
// Assumes only one dir under /home, the one matching the userid entered into
// the Raspberry Pi Imager when making the image.
function getUserID() {
    // Delete '/home/pi' if no corresponding userid exists. The homedir pi is
    // created by the moode-player package install during in-place update.
    if (file_exists('/home/pi/') && empty(sysCmd('grep ":/home/pi:" /etc/passwd'))) {
        sysCmd('cp /home/pi/.xinitrc /tmp/xinitrc');
        sysCmd('rm -rf /home/pi/');
    }
    // Return empty string if locked password for userid pi. A locked password
    // is from the pi-gen build and remains unless a userid is set in Pi Imager.
    if (sysCmd('cat /etc/shadow | grep pi | cut -d ":" -f 2')[0] == '!') {
        // No userid set in Pi Imager
        $userId = NO_USERID_DEFINED;
    } else {
        // Return userid or empty string if no subdirs under /home/
        $userId = sysCmd('ls /home/')[0];
        if (strpos($userId, 'ls: cannot access') !== false) {
            $userId = NO_USERID_DEFINED;
        }
    }

    // Install xinitrc script
    if ($userId != NO_USERID_DEFINED) {
        if (file_exists('/tmp/xinitrc')) {
            sysCmd('cp -f /tmp/xinitrc /home/' . $userId . '/.xinitrc');
        }
    }

    return $userId;
}
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply


Messages In This Thread
RE: Unexpected error message popup: The image does not contain userid, etc. - by Tim Curtis - Yesterday, 10:46 PM

Forum Jump: