07-18-2024, 02:30 PM
(07-18-2024, 01:56 PM)Kilkern Wrote: Weird thing - I did use the image prep when I installed Moode Audio the first time, and I've never used the *pi* user on any of my raspberries, as an old sysadmin, I hate the dependencies of a particular "hardcoded" user.
I wonder *what* created the pi user in the first place.
There ought to be an override variable in a suitable persistent config file to point to the preferred user, as these raspberries get more and more powerful, and more can do more at the same time ... so there will be more users configured.
Having said that, the short term fix is to ensure your preferred user is the only user present in /home
>>>>>>>.rune
(Kilkern)
What's the usage scenario where there would be multiple home dirs / userid's ?
In any case, during image build the moode-player package creates the home/pi dir in order to install .dircolors, .xinitrc and piano.sh files. The actual userid is not known at the time the image is built. That happens afterwords when prepping the image with the Pi Imager. The Imager creates a firstrun script that renames the userid pi to whatever was entered.
During an in-place update the moode-player package install will again create the home/pi dir if it doesn't exist. It won't exist if something other than pi was entered previously in the Imager.
The fix is to do some checking during moode startup (worker.php) and delete /home/pi if indicated. This is part of upcoming moode 9.0.5. See the code below in /var/www/inc/common.php
Code:
// Assumes only one dir under /home, the one corresponding to the userid
// entered into the Raspberry Pi Imager when prepping the image.
function getUserID() {
// Check for and delete '/home/pi' if it has no userid. This dir is created
// by the moode-player package install during in-place update.
if (file_exists('/home/pi/') && empty(sysCmd('grep "pi" /etc/passwd'))) {
sysCmd('rm -rf /home/pi/');
}
$result = sysCmd('ls /home/');
return $result[0];
}