peted-davis / WeatherFlow_PiConsole

Raspberry Pi Python console for WeatherFlow Tempest and Smart Home Weather Stations
GNU General Public License v3.0
156 stars 20 forks source link

Installer check for sudo user fails if installing from inside "sudo su - " shell #116

Closed TanerH closed 10 months ago

TanerH commented 1 year ago

I believe you might need some more logic around checking EUID==0 and blindly using $SUDO_USER as the $USER variable, in the installer :)

I normally invoke all my root shells via "sudo su -" which will not have $SUDO_USER set, and so this check in your install script will fail. I think you could either state something like "please run the installer from a user login" or perhaps you can just error out during install if "$SUDO_USER" ends up being blank, explaining you need to run this from a user shell, or from a "sudo bash" shell perhaps.

The result of this situation is that the install fails after trying to run the "usermod" utility, since $USER is blank (it just errors out and quits).

Otherwise, the installed worked just fine on my Ubuntu 22.04 box!

peted-davis commented 1 year ago

OK, the installer was not designed to be called by an elevated user. I will make it exit with an error in this case in the future

peted-davis commented 10 months ago

This has been implemented in v23.10.1