Skip to content

Commit

Permalink
verify that no one is attempting to flash cartographer directly on cr…
Browse files Browse the repository at this point in the history
…eality os or other build root based environments (#218) (#219)

Co-authored-by: Jason Pell <[email protected]>
  • Loading branch information
krautech and pellcorp committed Jan 9, 2025
1 parent d606552 commit 2655721
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions scripts/firmware.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python3

import os
import os.path
import re
import subprocess
import argparse
Expand Down Expand Up @@ -2445,6 +2446,15 @@ def install(self) -> None:
choices=[e.value for e in FlashMethod], # Use FlashMethod values
type=lambda s: FlashMethod(s.upper()), # Convert string to FlashMethod enum
)

if os.path.isfile('/etc/os-release'):
with open('/etc/os-release') as f:
release_info = f.read()
if 'ID=buildroot' in release_info:
print("\nFlashing is not currently supported on Build Root OS such as Creality OS. Exiting...")
print("Please follow this https://github.com/pellcorp/creality/wiki/Flashing-Carto-Firmware-on-Ubuntu")
exit(1)

try:
args = parser.parse_args(namespace=FirmwareNamespace())
Utils.configure_logging()
Expand Down

0 comments on commit 2655721

Please sign in to comment.