mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-26 16:56:19 +00:00
153 lines
6.2 KiB
Bash
Executable file
153 lines
6.2 KiB
Bash
Executable file
#!/bin/bash
|
|
#
|
|
# Configure Khanat
|
|
#
|
|
# Copyright (C) 2017 AleaJactaEst
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
declare DEBUG=0
|
|
|
|
usage()
|
|
{
|
|
cat << EOF
|
|
usage:$0 [options]
|
|
Configure Khanat
|
|
|
|
options:
|
|
-h, --help : Show this help
|
|
-d, --debug : Show debug message
|
|
EOF
|
|
}
|
|
|
|
#####################
|
|
# MAIN
|
|
#####################
|
|
source /opt/ext/servercontainer_function.sh
|
|
msg_info "[$(basename $0):$LINENO] => START"
|
|
|
|
while test $# -gt 0
|
|
do
|
|
case "$1" in
|
|
-h|--help)
|
|
usage
|
|
exit 1
|
|
;;
|
|
-d|--debug)
|
|
DEBUG=1
|
|
shift
|
|
;;
|
|
*)
|
|
msg_error "options '$1' not recoginze"
|
|
usage
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
####################################
|
|
# Load Environment
|
|
####################################
|
|
msg_debug "[$(basename $0):$LINENO] Load environment"
|
|
if [[ ! -f /opt/khanat_config.sh ]]
|
|
then
|
|
msg_error "[$(basename $0):$LINENO] - missing /opt/khanat_config.sh"
|
|
exit 2
|
|
fi
|
|
source /opt/khanat_config.sh
|
|
|
|
if [[ ! -f /home/gameserver/.bashrc ]]
|
|
then
|
|
msg_error "[$(basename $0):$LINENO] - missing /home/gameserver/.bashrc"
|
|
exit 2
|
|
fi
|
|
source /home/gameserver/.bashrc
|
|
|
|
####################################
|
|
# Copy configuration & update
|
|
####################################
|
|
msg_debug "[$(basename $0):$LINENO] configure frontend service"
|
|
copy_link "$KHANAT_PATH/server/frontend_service.cfg"
|
|
sed -i -r 's/(FSListenHost)(.*)(=)(.*)(;)/FSListenHost = "localhost";/g' $KHANAT_PATH/server/frontend_service.cfg || exit 2
|
|
|
|
msg_debug "[$(basename $0):$LINENO] configure database"
|
|
copy_link "$KHANAT_PATH/server/sql.cfg"
|
|
sed -i -r 's/(DBHost)(.*)(=)(.*)(;)/DBHost = "localhost";/g' $KHANAT_PATH/server/sql.cfg || exit 2
|
|
sed -i -r 's/(DBRingName)(.*)(=)(.*)(;)/ DBRingName = "ring_mini01";/g' $KHANAT_PATH/server/sql.cfg || exit 2
|
|
|
|
msg_debug "[$(basename $0):$LINENO] prepare sheet_id.bin"
|
|
copy_link "$KHANAT_PATH/server/leveldesign/game_elem/sheet_id.bin"
|
|
copy_link "$KHANAT_PATH/server/leveldesign/game_elem/sheets.txt"
|
|
cd /usr/local; /usr/local/bin/make_sheet_id \
|
|
-o$KHANAT_PATH/server/leveldesign/game_elem/sheet_id.bin \
|
|
$KHANAT_PATH/server/leveldesign/game_elem \
|
|
$KHANAT_PATH/server/leveldesign/game_element \
|
|
$KHANAT_PATH/server/leveldesign/world \
|
|
$KHANAT_PATH/server/leveldesign/ecosystems \
|
|
$KHANAT_PATH/server/sound \
|
|
$KHANAT_PATH/server/mirror_sheets 2>$KHANAT_HOME/log/configure/make_sheet_id.err 1>$KHANAT_HOME/log/configure/make_sheet_id.out || exit 2
|
|
|
|
msg_debug "prepare sheets_packer"
|
|
cat << EOF > $KHANAT_PATH/sheets_packer.cfg
|
|
/////////////////////////////////
|
|
/////////////////////////////////
|
|
/// SHEETS PACKER CONFIG FILE ///
|
|
/////////////////////////////////
|
|
/////////////////////////////////
|
|
DataPath = { "$KHANAT_PATH/server/common/data_leveldesign",
|
|
"$KHANAT_PATH/server/common/data_common",
|
|
"$KHANAT_PATH/server/client/data",
|
|
"$KHANAT_PATH/server/common",
|
|
"$KHANAT_PATH/server/leveldesign",
|
|
"$KHANAT_PATH/server/primitives" };
|
|
WorldSheet = "ryzom.world";
|
|
PrimitivesPath = "$KHANAT_PATH/server/primitives";
|
|
OutputDataPath = "$KHANAT_PATH/server/client/data";
|
|
LigoPrimitiveClass = "world_editor_classes.xml";
|
|
DumpVisualSlotsIndex = 1;
|
|
EOF
|
|
chown $UIDGAMESERVER:$GIDGAMESERVER $KHANAT_PATH/sheets_packer.cfg || exit 2
|
|
cd $KHANAT_PATH; sheets_packer 2>$KHANAT_HOME/log/configure/sheets_packer.err 1>$KHANAT_HOME/log/configure/sheets_packer.out || exit 2
|
|
|
|
rm -f $KHANAT_PATH/server/common/data_common/visual_slot.tab
|
|
cp $KHANAT_PATH/visual_slot.tab $KHANAT_PATH/server/common/data_common/visual_slot.tab || exit 2
|
|
cp $KHANAT_PATH/visual_slot.tab $KHANAT_PATH/server/client/data/visual_slot.tab || exit 2
|
|
|
|
# link translation
|
|
#for var in $KHANAT_PATH/server/translation/translated/*_en.txt; do nomfic=${var##*/}; ln -s $nomfic ${var%/*}/${nomfic/_en/_de}; done
|
|
#for var in $KHANAT_PATH/server/translation/translated/*_en.txt; do nomfic=${var##*/}; ln -s $nomfic ${var%/*}/${nomfic/_en/_es}; done
|
|
#for var in $KHANAT_PATH/server/translation/translated/*_wk.txt; do nomfic=${var##*/}; ln -s $nomfic ${var%/*}/${nomfic/_wk/_ru}; done
|
|
|
|
for var in $KHANAT_PATH/server/translation/translated/*_en.txt; do nomfic=${var##*/}; target="${var%/*}/${nomfic/_en/_de}"; rm -f $target; ln -s $nomfic $target; done
|
|
for var in $KHANAT_PATH/server/translation/translated/*_en.txt; do nomfic=${var##*/}; target="${var%/*}/${nomfic/_en/_es}"; rm -f $target; ln -s $nomfic $target; done
|
|
for var in $KHANAT_PATH/server/translation/translated/*_wk.txt; do nomfic=${var##*/}; target="${var%/*}/${nomfic/_wk/_ru}"; rm -f $target; ln -s $nomfic $target; done
|
|
|
|
|
|
####################################
|
|
# Copy screen configuration
|
|
####################################
|
|
msg_debug "[$(basename $0):$LINENO] screen configuration"
|
|
# Copy default screen configuration
|
|
cp $KHANAT_HOME/ext/ryzom-ressources/server/shard.screen.rc $KHANAT_PATH/server/shard.screen.rc || exit 2
|
|
sed -i -r 's/\$RYZOM_PATH\/\.\.\/build\/bin\///g' $KHANAT_PATH/server/shard.screen.rc || exit 2
|
|
sed -i -r 's/[-]A[.]/ /g' $KHANAT_PATH/server/shard.screen.rc || exit 2
|
|
sed -i -r 's/[-]C[.]/ -A\/home\/gameserver\/khanat\/server -C\/home\/gameserver\/khanat\/server /g' $KHANAT_PATH/server/shard.screen.rc || exit 2
|
|
sed -i -r 's/[-]L[.]/ -L\/home\/gameserver\/log\/khanat /g' $KHANAT_PATH/server/shard.screen.rc || exit 2
|
|
sed -i -r 's/[.][.]\/tools\/scripts\/linux\//\/home\/gameserver\/khanat\/tools\/scripts\/linux\//g' $KHANAT_PATH/server/shard.screen.rc || exit 2
|
|
|
|
####################################
|
|
# End
|
|
####################################
|
|
msg_info "[$(basename $0):$LINENO] => END"
|
|
|