khanat-server-docker-NeL/server/debian/common/serverimage_install_package.sh

105 lines
4 KiB
Bash
Raw Permalink Normal View History

#!/bin/bash
#
# Install binary and data
# 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/>.
function msg_debug()
{
if [[ $DEBUG -ne 0 ]]
then
echo "$(date "+%Y/%m/%d %H:%M:%S") DEBUG - $*"
fi
}
function msg_info()
{
echo "$(date "+%Y/%m/%d %H:%M:%S") INFO - $*"
}
function msg_error()
{
echo "$(date "+%Y/%m/%d %H:%M:%S") ERROR - $*" >&2
}
function msg_critical()
{
echo "$(date "+%Y/%m/%d %H:%M:%S") CRITICAL - $*" >&2
exit 2
}
echo "INSTALL PACKAGE"
# Load Environment
source /etc/apache2/envvars
export KHANAT_CLIENT_VERSION=1
if [[ ! -f /home/gameserver/.bashrc ]]
then
echo "ERROR - missing /home/gameserver/.bashrc"
exit 2
fi
source /home/gameserver/.bashrc
# install new package
cd /; tar xzf /opt/ryzomcore.tar.gz --strip 1 || msg_critical "[$LINENO] extract ryzomcore.tar.gz issue"
cd /opt; tar xzf ryzom-ressources.tar.gz || msg_critical "[$LINENO] extract ryzom-ressources.tar.gz issue"
# Create Home directory (if not exist)
mkdir -p $KHANAT_PATH || msg_critical "[$LINENO] create directory $KHANAT_PATH issue"
# install web khanat
ls -l /opt
ls -l /opt/code
cp -r /opt/code/web $KHANAT_PATH/khanatweb || msg_critical "[$LINENO] copy web data issue"
chmod -R a+w $KHANAT_PATH/khanatweb || msg_critical "[$LINENO] change right issue ($KHANAT_PATH/khanatweb)"
chown -R $APACHE_RUN_USER:$APACHE_RUN_GROUP $KHANAT_PATH/khanatweb || msg_critical "[$LINENO] change owner issue ($KHANAT_PATH/khanatweb)"
# Get Ressource
mkdir -p $KHANAT_DATA/ressources
(cd $KHANAT_DATA; tar xzf /opt/khanat-ressources.tar.gz) || msg_critical "[$LINENO] extract khanat-ressources.tar.gz issue"
# Copy script ryzom
mkdir -p $KHANAT_PATH/tools/scripts/linux
cp -r /opt/code/ryzom/tools/scripts/linux/* $KHANAT_PATH/tools/scripts/linux || msg_critical "[$LINENO] copy all script to $KHANAT_PATH/tools/scripts/linux"
# Copy data for server
mkdir -p $KHANAT_PATH/server || msg_critical "[$LINENO] create directory $KHANAT_PATH/server issue"
cp -r /opt/code/ryzom/common/ $KHANAT_PATH/common || msg_critical "[$LINENO] copy common data issue"
cp -r /opt/code/ryzom/client/ $KHANAT_PATH/client || msg_critical "[$LINENO] copy client data issue"
cp /opt/code/ryzom/server/*.cfg $KHANAT_PATH/server/. || msg_critical "[$LINENO] copy config issue"
# create link resource
## Directories
ln -s $KHANAT_DATA/collisions $KHANAT_PATH/server/
ln -s $KHANAT_DATA/leveldesign $KHANAT_PATH/server/
ln -s $KHANAT_DATA/primitives $KHANAT_PATH/server/
ln -s $KHANAT_DATA/translation $KHANAT_PATH/server/
ln -s $KHANAT_DATA/continents $KHANAT_PATH/server/
ln -s $KHANAT_DATA/common $KHANAT_PATH/server/
## Files
mkdir -p $KHANAT_PATH/server/data_shard
cp -r /opt/code/ryzom/server/data_shard/* $KHANAT_PATH/server/data_shard/.
ln -s $KHANAT_DATA/shard/su/dev_gm_names.xml $KHANAT_PATH/server/data_shard/dev_gm_names.xml
ln -s $KHANAT_DATA/shard/su/invalid_entity_names.txt $KHANAT_PATH/server/data_shard/invalid_entity_names.txt
ln -s $KHANAT_DATA/shard/su/reserved_names.xml $KHANAT_PATH/server/data_shard/reserved_names.xml
ln -s $KHANAT_DATA/shard/egs/game_event.txt $KHANAT_PATH/server/data_shard/game_event.txt
ln -s $KHANAT_DATA/shard/egs/mission_queues.txt $KHANAT_PATH/server/data_shard/mission_queues.txt
ln -s $KHANAT_DATA/shard/egs/named_items.txt $KHANAT_PATH/server/data_shard/named_items.txt
# copy data from khanat-code
mkdir -p $KHANAT_DATA/mirror_sheets
cp -r /opt/code/ryzom/server/data_shard/mirror_sheets/* $KHANAT_DATA/mirror_sheets