blob: dfd54da75c2a5ec2bdfe75d7bbb170b1b9f4b5a7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
#!/usr/bin/env bash
source "${0%/*}/common.sh"
declare -a default_hosts
################################################################################
## x86_64
# VPSFree
default_hosts+=( "lipwig" "mrpump" )
## aarch64
# Mox
default_hosts+=( "dean" "spt-mox" "spt-mox2" )
# Raspberry Pi
default_hosts+=( "adm-mpd" )
## armv7
# Omnia
default_hosts+=( "spt-omnia" "adm-omnia" "adm-omnia2" )
# Raspberry Pi
default_hosts+=( "spt-mpd" )
################################################################################
operation="${1:-}"
[ $# -gt 0 ] && shift
declare -a selected_hosts
if [ $# -gt 0 ]; then
for host in "$@"; do
selected_hosts+=("$(sshhost "$host")")
done
else
selected_hosts=("${default_hosts[@]}")
fi
for_hosts() {
for host in "${selected_hosts[@]}"; do
for op in "$@"; do
if ! "$op" "$host"; then
error "Operation '$op' failed for: $host" >&2
break
fi
done
done
}
case "$operation" in
help|h)
cat <<-EOF
Usage $0 operation [host]...
Local system builder and updater for remote hosts.
Operations:
build: build host system
copy: copy built system to the host
boot: set built system to be boot default on the host
switch: switch to the built system on the target host
test: test the built system on the target host
EOF
;;
build|b|"")
for_hosts build
;;
copy|c)
for_hosts copy
;;
boot)
for_hosts boot
;;
switch|s)
for_hosts switch
;;
test|t)
for_hosts switch_test
;;
build-copy|bc)
for_hosts build copy
;;
build-switch|bs)
for_hosts build copy switch
;;
build-test|bt)
for_hosts build copy switch_test
;;
build-boot|bb)
for_hosts build copy boot
;;
default)
echo "Unknown operation: $operation" >&2
exit 2
;;
esac
|