-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy_prosody.sh
executable file
·95 lines (71 loc) · 1.64 KB
/
deploy_prosody.sh
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
93
94
95
#!/bin/bash
## dependency: prepare_prosody.sh
cd `dirname $0`
. ./common.sh
usage="
Deploys the prosody XMPP IM server
Usage:
$(basename $0) <ssh addres of the server> -- [options forwarded to prepare_prosody]
[--help] [--debug] [--log <output file>]
where
ssh addres of the server - Address to the server, including username, e.g. [email protected]
--debug - Flag that sets debugging mode.
--log - Path to the log file that will log all meaningful commands
prepare_radicale supports the following options:
<server_name> - Name of the server. All clients should identify the server by its name otherwise the certificate wouldn't work
--add-user <user>:<password> - Adds user with on each run
Example2:
./$(basename $0) [email protected] -- --cal_user adam:password
"
ssh_address=$1
if [ -z "$1" ]; then
echo "$usage"
exit 0
fi
username=$(whoami)
user=auto
deb_folder=auto
install_lib=auto
opts=""
opts2=""
while [[ $# > 0 ]]
do
key="$1"
shift
case $key in
--debug)
debug=1
;;
--log)
log=$1
shift
;;
--help)
echo "$usage"
exit 0
;;
--)
opts2=$@
break
;;
-*)
echo "Error: Unknown option: $1" >&2
echo "$usage" >&2
exit 1
;;
esac
done
if [ -n "$debug" ]; then
opts2="$opts2 --debug"
if [ -z "$log" ]; then
log=/dev/stdout
else
opts2="$opts2 --log $log"
fi
fi
parse_URI $ssh_address
if [ -z "$ip" ]; then
errcho "You must provide a valid ssh address in the first argument"
exit 1
fi
./execute-script-remotely.sh prepare_prosody.sh --extra-executable files/prosody.config.lua --step-debug --ssh-address $ssh_address -- $opts2 --debug