From c3ccc2ab808d5341637ee338a6fbf53eced5fb3a Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Thu, 21 Aug 2025 16:00:54 +0200 Subject: [PATCH] clone: target image directory depending on box kind ionpimax_images, ionopi_images or rpi_images --- rpi/clone | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/rpi/clone b/rpi/clone index 70c8023..6b4267f 100755 --- a/rpi/clone +++ b/rpi/clone @@ -1,12 +1,23 @@ #!/usr/bin/env python3 import os import time +from pathlib import Path # go to script directory os.chdir(os.path.dirname(os.path.abspath(__file__))) + +def boxkind(): + sysclass = [] + for kind in 'ionopi', 'ionopimax': + if Path(f'/sys/class/{kind}').exists(): + sysclass.append(kind) + if len(sysclass) > 1: + raise RuntimeError(f'box kind not unique: {sysclass}') + return sysclass[0] if sysclass else 'rpi' + HOST = "l_samenv@linse-c" -SUBDIR = "boxes/rpi_images" +SUBDIR = "boxes/{boxkind()}_images" DEFDEST = f"{HOST}:{SUBDIR}" file = f"{time.strftime('%Y-%m-%d')}.lz4"