blob: 37985c36c689d86a7d0aca218afe08221da08aed (
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
|
#!/usr/bin/env bash
source "${0%/*}/common.sh"
operations() {
for op in "$@"; do
if ! "$op" "$(hostname)"; then
error "Operation '$op' failed" >&2
break
fi
done
}
################################################################################
operation="${1:-}"
if [ $# -gt 1 ]; then
echo "Invalid argument: $2" >&2
exit 2
fi
case "$operation" in
help|h)
cat <<-EOF
Usage $0 operation [device]...
Local system builder and updater for remote devices.
Operations:
build: build device system
boot: set built system to be boot default on the device
switch: switch to the built system on the target device
test: test the built system on the target device
EOF
;;
build|b)
operations build
;;
boot)
operations boot
;;
switch|s)
operations switch
;;
test|t)
operations switch_test
;;
build-switch|bs|"")
operations build switch
;;
build-test|bt)
operations build switch_test
;;
build-boot|bb)
operations build boot
;;
default)
echo "Unknown operation: $operation" >&2
exit 2
;;
esac
|