-
Notifications
You must be signed in to change notification settings - Fork 0
/
boot.py
32 lines (28 loc) · 1.1 KB
/
boot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import storage
from macropad_os import Config
default_config = Config("default_config.json").load()
config = Config("config.json").load(default_config)
dev_mode = config.get_item_by_name("dev_mode")
if dev_mode :
if not dev_mode.value:
print("file system should not be writable - dev mode not active")
storage.disable_usb_drive()
storage.remount("/", False)
dev_mode_active = config.get_item_by_name("dev_mode_active")
dev_mode_active.value = False
config.set_item(dev_mode_active)
config.save()
else:
# dev mode is on and needs to be disabled
print("Disabling dev mode before boot so that settings will work")
storage.disable_usb_drive()
storage.remount("/", False)
dev_mode = config.get_item_by_name("dev_mode")
dev_mode.value = False
config.set_item(dev_mode)
dev_mode_active = config.get_item_by_name("dev_mode_active")
dev_mode_active.value = True
config.set_item(dev_mode_active)
config.save()
storage.enable_usb_drive()
storage.remount("/", True)