diff options
author | Karel Kočí <cynerd@email.cz> | 2022-08-22 10:43:42 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2022-08-22 10:44:11 +0200 |
commit | 0068b7a9cc019e2a8c2c4d92b0a31e8823df2787 (patch) | |
tree | 4153638110cca6c66bb15510e3cc8c3c6f5e392a | |
parent | 31105755a9b8a1861836ee9f48ce4a9178f95c1a (diff) | |
download | nixos-personal-0068b7a9cc019e2a8c2c4d92b0a31e8823df2787.tar.gz nixos-personal-0068b7a9cc019e2a8c2c4d92b0a31e8823df2787.tar.bz2 nixos-personal-0068b7a9cc019e2a8c2c4d92b0a31e8823df2787.zip |
devices.sh: allow using ssh host name instead of network host name
-rw-r--r-- | common.sh | 8 | ||||
-rwxr-xr-x | devices.sh | 14 |
2 files changed, 18 insertions, 4 deletions
@@ -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 \ @@ -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[@]}") |