finish install implementation

This commit is contained in:
2022-06-10 21:50:51 +02:00
parent 45f63a7669
commit 24d7d53583

26
Run.sh
View File

@@ -5,15 +5,24 @@ OUTPUT_DIR="$2"
CFG_FILE="$3"
DEFAULT_CFG_FILE=UnrealTournament.ini
function add_iniKey() {
crudini --set $OUTPUT_DIR/System/$CFG_FILE $1 __$2 $3
function add_iniKeyEx() {
crudini --set $OUTPUT_DIR/System/$1 $2 __$3 $4
# Warning: ugly hack with sed to allow multiple key instances + to remove space around '='
sed -i "s/[[:space:]]*__$2[[:space:]]*=[[:space:]]*/$2=/g" $OUTPUT_DIR/System/$CFG_FILE
sed -i "s/[[:space:]]*__$(echo $3 | sed -e 's/\([[\/.*]\|\]\)/\\&/g')[[:space:]]*=[[:space:]]*/$(echo $3 | sed -e 's/\([[\/.*]\|\]\)/\\&/g')=/g" $OUTPUT_DIR/System/$1
}
# !!Warning!! section is not considered
function del_iniKeyEx() {
sed -i "/[[:space:]]*$(echo $3 | sed -e 's/\([[\/.*]\|\]\)/\\&/g')[[:space:]]*=[[:space:]]*$(echo $4 | sed -e 's/\([[\/.*]\|\]\)/\\&/g')/d" $OUTPUT_DIR/System/$1
}
function add_iniKey() {
add_iniKeyEx $CFG_FILE $1 $2 $3
}
# !!Warning!! section is not considered
function del_iniKey() {
sed -i "/[[:space:]]*$2[[:space:]]*=[[:space:]]*$3/d" $OUTPUT_DIR/System/$CFG_FILE
del_iniKeyEx $CFG_FILE $1 $2 $3
}
function add_ServerPackage() {
@@ -45,7 +54,9 @@ function enable() {
add_ServerPackage CountryFlags2
add_ServerActors ipToCountry.LinkActor
#todo: set iptocountry service
add_iniKeyEx IpToCountry.ini IpToCountry.LinkActor 'QueryServerHost[0]' Ip2Country.dmz.chacha.home
add_iniKeyEx IpToCountry.ini IpToCountry.LinkActor 'QueryServerFilePath[0]' '/ip2country.php'
add_iniKeyEx IpToCountry.ini IpToCountry.LinkActor 'QueryServerPort[0]' 8080
echo enable ok
}
@@ -55,6 +66,11 @@ function disable() {
del_ServerPackage CountryFlags2
del_ServerActors ipToCountry.LinkActor
del_iniKeyEx IpToCountry.ini IpToCountry.LinkActor 'QueryServerHost[0]' Ip2Country.dmz.chacha.home
del_iniKeyEx IpToCountry.ini IpToCountry.LinkActor 'QueryServerFilePath[0]' '/ip2country.php'
del_iniKeyEx IpToCountry.ini IpToCountry.LinkActor 'QueryServerPort[0]' 8080
echo disable ok
}