Fix two confirmed findings from full codebase audit

- patch_ui.py: wrap shutil.copy2 backup in try/except OSError so a
  permission or read-only filesystem error prints a specific diagnostic
  instead of crashing the script with a generic 'exited non-zero' message
- install.sh: add early guard that detects pipe-install (bash <(curl ...))
  and exits with a clear error pointing to the git clone workflow
This commit is contained in:
flan committed 2026-06-15 16:03:19 +00:00
1 parent 2a3b15b4b2
commit 7c9aa7159a
2 files changed
+13 -1

No files matched your search

+5 -1
View File
@@ -90,7 +90,11 @@ def main():
backup = path + ".pre-truecloud-patch"
if not os.path.exists(backup):
shutil.copy2(path, backup)
try:
shutil.copy2(path, backup)
except OSError as exc:
print(f"[truecloud-patch] ERROR: Could not create backup {backup}: {exc}")
return
patched, count = FIND.subn(REPLACE, content)
if count != 1: