diff --git a/boot.py b/boot.py index e69de29..8657e1a 100644 --- a/boot.py +++ b/boot.py @@ -0,0 +1,38 @@ +import os +import time + +import storage + +mount_points = [ + "/sd", +] + +wait_time = 0.02 + +storage.disable_usb_drive() +print("Disabling USB drive") +time.sleep(wait_time) + +storage.remount("/", False) +print("Remounting root filesystem") +time.sleep(wait_time) + +attempts = 0 +while attempts < 5: + attempts += 1 + try: + for path in mount_points: + try: + os.mkdir(path) + print(f"Mount point {path} created.") + except OSError: + print(f"Mount point {path} already exists.") + except Exception as e: + print(f"Error creating mount point {path}: {e}") + time.sleep(wait_time) + continue + + break + +storage.enable_usb_drive() +print("Enabling USB drive")