install: Do not fail on invalid SSH key

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2576
This commit is contained in:
Anri Dellal 2025-03-31 17:02:58 +03:00 committed by Oliver Smith
parent e9038e50d6
commit a80b27d0bd
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -308,7 +308,13 @@ def copy_ssh_keys(config: Config) -> None:
keys = []
for key in glob.glob(os.path.expanduser(config.ssh_key_glob)):
with open(key) as infile:
try:
keys += infile.readlines()
except UnicodeDecodeError:
logging.info(
f"WARNING: {key} is not a valid SSH key. "
"This file will not be copied to device."
)
if not len(keys):
logging.info(