blob: 76f49aaf2300ea0fedaa26b7870870e85b6737c3 (
plain) (
blame)
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
|
#!/bin/bash
function create_pipe {
trap "rm -f $PIPE" EXIT
if [[ ! -p $PIPE ]]; then
echo "Making pipe $PIPE"
rm -f $PIPE
mkfifo $PIPE
fi
}
# $1 - text
function send_all_pipes {
echo $1 >$LOGIN_PIPE
echo $1 >$CHAR_PIPE
}
# $1 - text
function send_char_pipe {
echo $1 >$CHAR_PIPE
}
# $1 - server binary name
# $2 - sleep time
function server_logic {
create_pipe
$1
while true
do
if read line <$PIPE; then
echo pipe: $line
if [[ "$line" == 'exit' ]]; then
exit
fi
if [[ "$line" == 'restart' ]]; then
sleep $2
$1
fi
fi
done
}
function stash_save {
STR=$(git diff --stat --color=always)
if [[ -n "${STR}" ]]; then
echo ${1}: git stash save "wrapper pull"
git stash save "wrapper pull"
export ${1}_saved="1"
else
export ${1}_saved="0"
fi
}
function stash_pop {
var="${1}_saved"
eval var=\$$var
if [[ "${var}" == "1" ]]; then
echo ${1}: git stash pop
git stash pop
fi
}
function pull_all {
stash_save "data"
cd ../server-code
stash_save "code"
cd src/evol
stash_save "plugin"
cd ../../../tools
stash_save "tools"
cd ..
./pull.sh
cd server-data
stash_pop "data"
cd ../server-code
stash_pop "code"
cd src/evol
stash_pop "plugin"
cd ../../../tools
stash_pop "tools"
cd ..
./status.sh
cd server-data
}
|