test for bookworm -> staring cbpi w/o sudo install with pipx

This commit is contained in:
avollkopf 2023-10-14 16:17:03 +02:00
parent 72ea6ac2d7
commit 252c2d171b
2 changed files with 7 additions and 8 deletions

View file

@ -44,8 +44,8 @@ class CraftBeerPiCli():
def list_one_wire(self): def list_one_wire(self):
print("List 1Wire") print("List 1Wire")
call(["modprobe", "w1-gpio"]) call(["sudo","modprobe", "w1-gpio"])
call(["modprobe", "w1-therm"]) call(["sudo","modprobe", "w1-therm"])
try: try:
for dirname in os.listdir('/sys/bus/w1/devices'): for dirname in os.listdir('/sys/bus/w1/devices'):
if (dirname.startswith("28") or dirname.startswith("10")): if (dirname.startswith("28") or dirname.startswith("10")):
@ -155,7 +155,7 @@ class CraftBeerPiCli():
if os.path.exists(os.path.join("/etc/systemd/system","craftbeerpi.service")) is False: if os.path.exists(os.path.join("/etc/systemd/system","craftbeerpi.service")) is False:
srcfile = self.config.get_file_path("craftbeerpi.service") srcfile = self.config.get_file_path("craftbeerpi.service")
destfile = os.path.join("/etc/systemd/system") destfile = os.path.join("/etc/systemd/system")
shutil.copy(srcfile, destfile) shutil.os.system('sudo cp "{}" "{}"'.format(srcfile,destfile))
print("Copied craftbeerpi.service to /etc/systemd/system") print("Copied craftbeerpi.service to /etc/systemd/system")
os.system('systemctl enable craftbeerpi.service') os.system('systemctl enable craftbeerpi.service')
print('Enabled craftbeerpi service') print('Enabled craftbeerpi service')
@ -180,7 +180,7 @@ class CraftBeerPiCli():
print('craftbeerpi.service service is not running') print('craftbeerpi.service service is not running')
if os.path.exists(os.path.join("/etc/systemd/system","craftbeerpi.service")) is True: if os.path.exists(os.path.join("/etc/systemd/system","craftbeerpi.service")) is True:
os.remove(os.path.join("/etc/systemd/system","craftbeerpi.service")) shutil.os.system('sudo rm -rf "{}"'.format(os.path.join("/etc/systemd/system","craftbeerpi.service")))
print("Deleted craftbeerpi.service from /etc/systemd/system") print("Deleted craftbeerpi.service from /etc/systemd/system")
else: else:
print("craftbeerpi.service is not located in /etc/systemd/system") print("craftbeerpi.service is not located in /etc/systemd/system")
@ -189,7 +189,6 @@ class CraftBeerPiCli():
return return
return return
def chromium(self, name): def chromium(self, name):
'''Enable or disable autostart''' '''Enable or disable autostart'''
if(name == "status"): if(name == "status"):

View file

@ -170,7 +170,7 @@ def setup(cbpi):
cbpi.plugin.register("OneWire", OneWire) cbpi.plugin.register("OneWire", OneWire)
try: try:
# Global Init # Global Init
call(["modprobe", "w1-gpio"]) call(["sudo","modprobe", "w1-gpio"])
call(["modprobe", "w1-therm"]) call(["sudo","modprobe", "w1-therm"])
except Exception as e: except Exception as e:
pass pass