Skip to content

Commit 9e8d020

Browse files
committed
adapt onewire setup in cli.py (issue #173)
1 parent b1cd742 commit 9e8d020

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

cbpi/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
__version__ = "4.7.1.a3"
1+
__version__ = "4.7.1.a4"
22
__codename__ = "Winter Bock"

cbpi/cli.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,23 @@ def start(self):
5151

5252
def setup_one_wire(self):
5353
print("Setting up 1Wire")
54-
with open("/boot/config.txt", "r") as f:
54+
with open("/boot/firmware/config.txt", "r") as f:
5555
lines = f.readlines()
56-
lines.append("dtoverlay=w1-gpio,gpiopin=4,pullup=on")
56+
if "dtoverlay=w1-gpio,gpiopin=4,pullup=on\n" not in lines:
57+
lines.append("dtoverlay=w1-gpio,gpiopin=4,pullup=on\n")
5758

5859
configtempfile = os.path.join(self.config.get_file_path(""), "config.txt")
5960

6061
with open(configtempfile, "w") as f:
6162
for line in lines:
6263
f.write(line)
63-
destfile = "/boot/config.txt"
64+
destfile = "/boot/firmware/config.txt"
6465

6566
# copy and remove afterwards as mv will work, but raise an error message due to different file owners
6667
shutil.os.system('sudo cp "{}" "{}"'.format(configtempfile, destfile))
6768
shutil.os.system('rm -rf "{}"'.format(configtempfile))
6869

69-
print("/boot/config.txt created")
70+
print("/boot/firmware/config.txt created")
7071

7172
def list_one_wire(self):
7273
print("List 1Wire")
@@ -393,7 +394,7 @@ def chromium(self, name):
393394
if os.path.exists(file) is False:
394395
pathlib.Path(file).mkdir(parents=True, exist_ok=True)
395396
with open(file, "a") as f:
396-
f.write('chromium = /usr/bin/chromium --start-fullscreen --start-maximized --password-store=basic --app=http://localhost:8000')
397+
f.write('chromium = /usr/bin/chromium --start-maximized --start-fullscreen --password-store=basic --app=http://localhost:8000')
397398
print("Added chromium to labwc autostart")
398399
print(
399400
"CraftBeerPi Chromium Autostart is {}ON{}".format(
@@ -418,7 +419,7 @@ def chromium(self, name):
418419
return
419420
else:
420421
with open(file, "a") as f:
421-
f.write('chromium = /usr/bin/chromium --start-fullscreen --start-maximized --password-store=basic --app=http://localhost:8000')
422+
f.write('chromium = /usr/bin/chromium --start-maximized --start-fullscreen --password-store=basic --app=http://localhost:8000')
422423
print("Added chromium to labwc autostart")
423424
print(
424425
"CraftBeerPi Chromium Autostart is {}ON{}".format(

0 commit comments

Comments
 (0)