clone: target image directory depending on box kind
ionpimax_images, ionopi_images or rpi_images
This commit is contained in:
13
rpi/clone
13
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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user