chromium autostart should be also working w/o sudo

This commit is contained in:
avollkopf 2023-10-14 16:33:41 +02:00
parent 8b2aaace1e
commit e044545a5b

View file

@ -202,7 +202,7 @@ class CraftBeerPiCli():
if os.path.exists(os.path.join("/etc/xdg/autostart/","chromium.desktop")) is False: if os.path.exists(os.path.join("/etc/xdg/autostart/","chromium.desktop")) is False:
srcfile = self.config.get_file_path("chromium.desktop") srcfile = self.config.get_file_path("chromium.desktop")
destfile = os.path.join("/etc/xdg/autostart/") destfile = os.path.join("/etc/xdg/autostart/")
shutil.copy(srcfile, destfile) shutil.os.system('sudo cp "{}" "{}"'.format(srcfile,destfile))
print("Copied chromium.desktop to /etc/xdg/autostart/") print("Copied chromium.desktop to /etc/xdg/autostart/")
else: else:
print("chromium.desktop is already located in /etc/xdg/autostart/") print("chromium.desktop is already located in /etc/xdg/autostart/")
@ -214,7 +214,7 @@ class CraftBeerPiCli():
print("Remove chromium.desktop from /etc/xdg/autostart/") print("Remove chromium.desktop from /etc/xdg/autostart/")
try: try:
if os.path.exists(os.path.join("/etc/xdg/autostart/","chromium.desktop")) is True: if os.path.exists(os.path.join("/etc/xdg/autostart/","chromium.desktop")) is True:
os.remove(os.path.join("/etc/xdg/autostart/","chromium.desktop")) shutil.os.system('sudo rm -rf "{}"'.format(os.path.join("/etc/xdg/autostart/","chromium.desktop")))
print("Deleted chromium.desktop from /etc/xdg/autostart/") print("Deleted chromium.desktop from /etc/xdg/autostart/")
else: else:
print("chromium.desktop is not located in /etc/xdg/autostart/") print("chromium.desktop is not located in /etc/xdg/autostart/")