khanat-server-docker-NeL/server/debian/common/serverimage_initialize_khanat_server.sh
2017-11-21 22:10:28 +01:00

104 lines
4 KiB
Bash
Executable file
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
#
# Configure server Khanat
# Copyright (C) 2017 AleaJactaEst
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
echo "INITIALIZE KHANAT SERVER"
#######################
# GET PARAM ENVIRONMENT
#######################
export KHANAT_CLIENT_VERSION=1
if [[ ! -f /home/gameserver/.bashrc ]]
then
echo "ERROR - missing /home/gameserver/.bashrc"
exit 2
fi
# load environment
source /home/gameserver/.bashrc
# Load
if [[ -f /opt/khanat_config.sh ]]
then
echo "Configuration loaded"
source /opt/khanat_config.sh
echo "KHANAT_CLIENT_VERSION:$KHANAT_CLIENT_VERSION"
fi
# configure khanat server
sed -i -r 's/(FSListenHost)(.*)(=)(.*)(;)/FSListenHost = "localhost";/g' $KHANAT_PATH/server/frontend_service.cfg || exit 2
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
# Generate data
cd /usr/local; /usr/local/bin/make_sheet_id \
-o$KHANAT_DATA/leveldesign/game_elem/sheet_id.bin \
$KHANAT_DATA/leveldesign/game_elem \
$KHANAT_DATA/leveldesign/game_element \
$KHANAT_DATA/leveldesign/world \
$KHANAT_DATA/leveldesign/ecosystems \
$KHANAT_DATA/sound \
$KHANAT_DATA/mirror_sheets || exit 2
# configure sheets_packer.cfg
rm -rf /opt/sheets_packer/*
mkdir -p /opt/sheets_packer/common /opt/sheets_packer/khanat-ressources /opt/sheets_packer/client
cat << EOF > /opt/sheets_packer/sheets_packer.cfg
/////////////////////////////////
/////////////////////////////////
/// SHEETS PACKER CONFIG FILE ///
/////////////////////////////////
/////////////////////////////////
DataPath = { "/opt/sheets_packer/common/data_leveldesign",
"/opt/sheets_packer/common/data_common",
"/opt/sheets_packer/client/data",
"/opt/sheets_packer/khanat-ressources/common",
"/opt/sheets_packer/khanat-ressources/leveldesign",
"/opt/sheets_packer/khanat-ressources/primitives" };
WorldSheet = "ryzom.world";
PrimitivesPath = "/opt/sheets_packer/khanat-ressources/primitives";
OutputDataPath = "/opt/sheets_packer/client/data";
LigoPrimitiveClass = "world_editor_classes.xml";
DumpVisualSlotsIndex = 1;
EOF
# copy data to target
cp -r /opt/code/ryzom/common/* /opt/sheets_packer/common || exit 2
cp -r $KHANAT_DATA/* /opt/sheets_packer/khanat-ressources || exit 2
cp -r /opt/code/ryzom/client/* /opt/sheets_packer/client || exit 2
cd /opt/sheets_packer; sheets_packer || exit 2
cp /opt/sheets_packer/visual_slot.tab $KHANAT_PATH/common/data_common/visual_slot.tab || exit 2
cp /opt/sheets_packer/visual_slot.tab $KHANAT_PATH/client/data/visual_slot.tab || exit 2
# link translation
for var in $KHANAT_DATA/translation/translated/*_en.txt; do nomfic=${var##*/}; ln -s $nomfic ${var%/*}/${nomfic/_en/_de}; done
for var in $KHANAT_DATA/translation/translated/*_en.txt; do nomfic=${var##*/}; ln -s $nomfic ${var%/*}/${nomfic/_en/_es}; done
for var in $KHANAT_DATA/translation/translated/*_wk.txt; do nomfic=${var##*/}; ln -s $nomfic ${var%/*}/${nomfic/_wk/_ru}; done
# Copy default screen configuration
cp /opt/code/ryzom/server/shard.screen.rc $KHANAT_PATH/server/shard.screen.rc
sed -i -r 's/\$RYZOM_PATH\/\.\.\/build\/bin\///g' $KHANAT_PATH/server/shard.screen.rc
ln -s /usr/local /home/gameserver/build
# create default directory for rrd data
mkdir -p $KHANAT_PATH/server/save_shard/rrd_graphs