From 0068b7a9cc019e2a8c2c4d92b0a31e8823df2787 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Mon, 22 Aug 2022 10:43:42 +0200 Subject: devices.sh: allow using ssh host name instead of network host name --- common.sh | 8 ++++++++ devices.sh | 14 ++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/common.sh b/common.sh index 4f005de..1af840d 100644 --- a/common.sh +++ b/common.sh @@ -35,6 +35,11 @@ sshdest() { awk -F- 'NF > 1 { print $2"."$1; exit } { print $1 }' <<<"$1" } +# Reverse opeartion for sshdest +sshhost() { + awk -F. 'NF > 1 { print $2"-"$1; exit } { print $1 }' <<<"$1" +} + _sh() { if [ $# -gt 1 ]; then "$@" @@ -92,6 +97,9 @@ build() { if [ "$(device_system "$device")" = "armv7l-linux" ]; then toplevel=".config.system.build.cross.x86_64-linux${toplevel}" fi + if [ "$(device_system "$device")" = "aarch64-linux" ]; then + toplevel=".config.system.build.cross.x86_64-linux${toplevel}" + fi stage "Building system for device: $device" nix build \ diff --git a/devices.sh b/devices.sh index 3a2dce5..6c1f30b 100755 --- a/devices.sh +++ b/devices.sh @@ -42,11 +42,17 @@ operation="${1:-}" declare -a selected_devices if [ $# -gt 0 ]; then for device in "$@"; do - if ! valid_device "$device"; then - error "No such device: $device" >&2 - exit 2 + if valid_device "$device"; then + selected_devices+=("$device") + else + asdev="$(sshhost "$device")" + if valid_device "$asdev"; then + selected_devices+=("$asdev") + else + error "No such device: $device" >&2 + exit 2 + fi fi - selected_devices+=("$device") done else selected_devices=("${devices[@]}") -- cgit v1.2.3