blob: 94541a4f660524af7d0f0eb7d2616e65bdedae89 (
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
|
#!/usr/bin/env bash
function check_client_status {
local try=0
local ip="$1"
local state="$2"
local max_tries=${3-10}
while [ "$(./ogcli list clients | jq ".clients[] | select(.state != \"$state\" and .addr == \"$ip\")")" == "" ]
do
if [ "$try" -eq "$max_tries" ]; then
echo "Timeout!"
exit
fi
try=$((try+1))
echo "Waiting for client to exit from state $state..."
sleep 10
done
}
IP="192.168.56.11"
echo "Sending WoL to client $IP"
./ogcli send wol --client-ip "$IP"
check_client_status $IP "WOL_SENT"
echo "Client is ready... partitioning client"
./ogcli setup disk --type dos --num 1 --part 1,LINUX,EXT4,40G --part 4,CACHE,CACHE,10G --format 1,4 --client-ip "$IP"
# ./ogcli send refresh --client-ip "$IP"
check_client_status $IP "BSY"
echo "Client is ready... restoring image"
./ogcli restore image --id 1 --disk 1 --part 1 --type tiptorrent --client-ip "$IP"
check_client_status $IP "BSY" 100
echo "Client is ready... setting boot mode to first disk first partition"
./ogcli set mode --mode 11 --client-ip "$IP"
check_client_status $IP "BSY"
echo "Client is ready... shutting down client"
./ogcli send poweroff --client-ip "$IP"
|