test for autostart with different routine to detect user

This commit is contained in:
avollkopf 2024-07-02 21:17:34 +02:00
parent 591f933db0
commit 62370980e0
2 changed files with 4 additions and 3 deletions

View file

@ -1,3 +1,3 @@
__version__ = "4.4.3.a1" __version__ = "4.4.3.a2"
__codename__ = "Yeast Starter" __codename__ = "Yeast Starter"

View file

@ -7,7 +7,7 @@ from cbpi.configFolder import ConfigFolder
from cbpi.utils.utils import load_config from cbpi.utils.utils import load_config
from zipfile import ZipFile from zipfile import ZipFile
from cbpi.craftbeerpi import CraftBeerPi from cbpi.craftbeerpi import CraftBeerPi
import os import os, pwd
import pkgutil import pkgutil
import shutil import shutil
import click import click
@ -165,7 +165,8 @@ class CraftBeerPiCli():
else: else:
print("CraftBeerPi Autostart is {}OFF{}".format(Fore.RED,Style.RESET_ALL)) print("CraftBeerPi Autostart is {}OFF{}".format(Fore.RED,Style.RESET_ALL))
elif(name == "on"): elif(name == "on"):
user=os.getlogin() #user=os.getlogin()
user=pwd.getpwuid(os.getuid()).pw_name
path="/usr/local/bin/cbpi" path="/usr/local/bin/cbpi"
if os.path.exists("/home/"+user+"/.local/bin/cbpi") is True: if os.path.exists("/home/"+user+"/.local/bin/cbpi") is True:
path="/home/"+user+"/.local/bin/cbpi" path="/home/"+user+"/.local/bin/cbpi"