mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-21 14:38:15 +01:00
fix for installation on bullseye with sudo and autostart
This commit is contained in:
parent
bead2b30ae
commit
1b666be9bc
3 changed files with 6 additions and 3 deletions
|
@ -1,3 +1,3 @@
|
|||
__version__ = "4.2.0.a4"
|
||||
__version__ = "4.2.0.a5"
|
||||
__codename__ = "Indian Summer"
|
||||
|
||||
|
|
|
@ -151,6 +151,9 @@ class CraftBeerPiCli():
|
|||
print("CraftBeerPi Autostart is {}OFF{}".format(Fore.RED,Style.RESET_ALL))
|
||||
elif(name == "on"):
|
||||
user=os.getlogin()
|
||||
path="/usr/local/bin/cbpi start"
|
||||
if os.path.exists("/home/"+user+"/.local/bin/cbpi") is True:
|
||||
path="/home/"+user+"/.local/bin/cbpi start"
|
||||
print("Add craftbeerpi.service to systemd")
|
||||
try:
|
||||
if os.path.exists(os.path.join("/etc/systemd/system","craftbeerpi.service")) is False:
|
||||
|
@ -166,7 +169,7 @@ class CraftBeerPiCli():
|
|||
srcfile=str(srcfile).replace('\\','/')
|
||||
|
||||
template = templateEnv.get_template("craftbeerpi.service")
|
||||
outputText = template.render(user=user)
|
||||
outputText = template.render(user=user, path=path)
|
||||
with open(srcfile, "w") as fh:
|
||||
fh.write(outputText)
|
||||
destfile = os.path.join("/etc/systemd/system")
|
||||
|
|
|
@ -3,7 +3,7 @@ Description=Craftbeer Pi
|
|||
|
||||
[Service]
|
||||
WorkingDirectory=/home/{{ user }}
|
||||
ExecStart=/home/{{ user }}/.local/bin/cbpi start
|
||||
ExecStart={{ path }} start
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
Loading…
Reference in a new issue