File tree 2 files changed +22
-39
lines changed
2 files changed +22
-39
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 8
8
# --host HOSTNAME (to configure connection for non mikr.us host)
9
9
# username@test.com (without param in front)
10
10
11
- # Read hosts from serwery.txt
12
- declare -A hosts
13
- while IFS=' =' read -r key value; do
14
- hosts[" $key " ]=" $value "
15
- done < " ../serwery.txt"
16
-
17
11
# some bash magic: https://brianchildress.co/named-parameters-in-bash/
18
12
while [ $# -gt 0 ]; do
19
13
if [[ $1 == * " --" * ]]; then
@@ -50,6 +44,28 @@ if [ -n "$mikrus" ]; then
50
44
port=" $(( 10000 + $(echo $mikrus | grep - o '[0 - 9 ]\+ ') )) "
51
45
52
46
key=" $( echo $mikrus | grep -o ' [^0-9]\+' ) "
47
+
48
+ url=" https://mikr.us/serwery.txt"
49
+ servers=" "
50
+ if command -v curl & > /dev/null; then
51
+ servers=$( curl -s " $url " )
52
+ elif command -v wget & > /dev/null; then
53
+ servers=$( wget -q -O - " $url " )
54
+ else
55
+ echo " ERROR: Neither 'curl' nor 'wget' were found."
56
+ exit 1
57
+ fi
58
+
59
+ if [ -z " $servers " ]; then
60
+ echo " ERROR: Unable to download the list of servers."
61
+ exit 1
62
+ fi
63
+
64
+ declare -A hosts
65
+ while IFS=' =' read -r server value; do
66
+ hosts[" $server " ]=" $value "
67
+ done <<< " $servers"
68
+
53
69
host=" ${hosts[$key]} "
54
70
if [ -z " $host " ]; then
55
71
echo " ERROR: Server hostname not known for key '$key '."
You can’t perform that action at this time.
0 commit comments