Add_server function pretty much done except for the bug squishin'.
This commit is contained in:
parent
f99d620b21
commit
ef098a76a2
24
tojam
24
tojam
@ -67,7 +67,7 @@ add_server() {
|
|||||||
errorMessage=""
|
errorMessage=""
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
servers[${serverInfo[0]}]="${serverInfo[1]}:${serverInfo[2]}"
|
echo "[${serverInfo[0]}]=\"${serverInfo[1]}:${serverInfo[2]}\"" >> "${config}/servers.conf"
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,10 +99,10 @@ mkdir -p "${config}"
|
|||||||
|
|
||||||
if ! [[ -r "${config}/config" ]]; then
|
if ! [[ -r "${config}/config" ]]; then
|
||||||
# Write initial config file
|
# Write initial config file
|
||||||
echo 'anonymous="true"' >> "${config}/config"
|
{ echo 'anonymous="true"';
|
||||||
echo 'saveSourceFiles="false"' >> "${config}/config"
|
echo 'saveSourceFiles="false"';
|
||||||
echo 'soundDriver="jack"' >> "${config}/config"
|
echo 'soundDriver="jack"';
|
||||||
echo "userName='Tojam$(date '+%S')'" >> "${config}/config"
|
echo "userName='Tojam$(date '+%S')'"; } >> "${config}/config"
|
||||||
fi
|
fi
|
||||||
source "${config}/config"
|
source "${config}/config"
|
||||||
|
|
||||||
@ -125,6 +125,20 @@ declare -A servers=(
|
|||||||
[Ninjamer 4]="ninjamer.com:2052"
|
[Ninjamer 4]="ninjamer.com:2052"
|
||||||
$( [[ -r "${config}/servers.conf" ]] && source "${config}/servers.conf")
|
$( [[ -r "${config}/servers.conf" ]] && source "${config}/servers.conf")
|
||||||
)
|
)
|
||||||
|
if [[ -r "${config}/servers.conf" ]]; then
|
||||||
|
while IFS="=" read -r key value; do
|
||||||
|
if [[ "$key" =~ ^\[.*\]$ && "$value" =~ ^\".*\"$ ]]; then
|
||||||
|
key="${key#[}"
|
||||||
|
key="${key%]}"
|
||||||
|
value="${value#\"}"
|
||||||
|
value="${value%\"}"
|
||||||
|
servers["$key"]="$value"
|
||||||
|
else
|
||||||
|
echo "Error: invalid format in ${config}/servers.conf" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done < <(sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' "${config}/servers.conf")
|
||||||
|
fi
|
||||||
|
|
||||||
# Server menu
|
# Server menu
|
||||||
declare -a menuList
|
declare -a menuList
|
||||||
|
Loading…
Reference in New Issue
Block a user