forked from DDRRE/ddut4
-
Notifications
You must be signed in to change notification settings - Fork 1
/
editConfig.sh
52 lines (46 loc) · 1.55 KB
/
editConfig.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
#!/bin/bash
for cnffiles in ddut4_init.def
do
if [ -f "$cnffiles" ]
then
source "$cnffiles"
if [[ $? != '0' ]]
then
echo "Couldn't load ${cnffiles}. Terminating."
exit 1
#no need for 'else' here
fi
#iecho "Loaded configuration file: $(pwd)/${cnffiles}"
else
echo "Couldn't find ${cnffiles}. Terminating."
exit 1
fi
done
if which nano &>/dev/null
then
editor='nano'
else
editor='vi'
fi
if [[ $1 == '' ]]
then
echo "No SRVNAME specified."
echo "Usage: editConfig.sh SRVNAME [nosync]"
exit 1
fi
if [[ $2 == 'nosync' ]]
then
nosync=1
fi
if [ ! -f ${rootdir}/ut4-"$1"/UnrealTournament/Saved/Config/LinuxServer/Game.ini ]
then
echo "NOTE: ${rootdir}/ut4-$1/UnrealTournament/Saved/Config/LinuxServer/Game.ini doesn't exist."
read -p "Press enter to continue."
fi
$editor ${rootdir}/ut4-"$1"/UnrealTournament/Saved/Config/LinuxServer/Game.ini
if [[ $nosync != '1' ]] && [[ $? == 0 ]]
then
echo "Syncing Game.ini for ${1} to ${1}-Game.ini"
echo "(disable this by running editConfig.sh SRVNAME nosync)"
cp ${rootdir}/ut4-"$1"/UnrealTournament/Saved/Config/LinuxServer/Game.ini ${confdir}/"${1}"-Game.ini
fi