187 lines
8.4 KiB
Bash
Executable file
187 lines
8.4 KiB
Bash
Executable file
#!/bin/bash
|
|
#
|
|
# Configure Link (link package, ...)
|
|
# 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/>.
|
|
|
|
usage()
|
|
{
|
|
cat << EOF
|
|
usage:$0 [options]
|
|
Configure Link
|
|
|
|
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)
|
|
set_debug 1
|
|
shift
|
|
;;
|
|
*)
|
|
msg_error "options '$1' not recognize"
|
|
usage
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
####################################
|
|
# Load Environment
|
|
####################################
|
|
msg_debug "Load environment"
|
|
if [[ ! -f /opt/khanat_config.sh ]]
|
|
then
|
|
echo "ERROR - missing /opt/khanat_config.sh"
|
|
exit 2
|
|
fi
|
|
source /opt/khanat_config.sh
|
|
|
|
if [[ ! -f /home/gameserver/.bashrc ]]
|
|
then
|
|
echo "ERROR - missing /home/gameserver/.bashrc"
|
|
exit 2
|
|
fi
|
|
source /home/gameserver/.bashrc
|
|
|
|
####################################
|
|
# Create directory target
|
|
####################################
|
|
msg_debug "create directory target"
|
|
create_dir_gameserver "$KHANAT_PATH" || exit 2
|
|
create_dir_gameserver "$KHANAT_PATH/server" || exit 2
|
|
#create_dir_gameserver "$KHANAT_PATH/server/collisions" || exit 2
|
|
create_dir_gameserver "$KHANAT_PATH/server/leveldesign" || exit 2
|
|
#create_dir_gameserver "$KHANAT_PATH/server/primitives" || exit 2
|
|
create_dir_gameserver "$KHANAT_PATH/server/translation" || exit 2
|
|
#create_dir_gameserver "$KHANAT_PATH/server/continents" || exit 2
|
|
create_dir_gameserver "$KHANAT_PATH/server/common" || exit 2
|
|
create_dir_gameserver "$KHANAT_PATH/server/data_shard" || exit 2
|
|
create_dir_gameserver "$KHANAT_PATH/server/sound" || exit 2
|
|
create_dir_gameserver "$KHANAT_PATH/server/client" || exit 2
|
|
create_dir_gameserver "$KHANAT_PATH/server/save_shard" || exit 2
|
|
create_dir_gameserver "$KHANAT_PATH/server/save_shard/rrd_graphs" || exit 2
|
|
create_dir_gameserver "$KHANAT_PATH/patch_service" || exit 2
|
|
create_dir_gameserver "$KHANAT_HOME/log/configure" || exit 2
|
|
|
|
create_dir_gameserver "$PATCH_CLIENT_SYSTEM/kh_server" || exit 2
|
|
create_dir_gameserver "$PATCH_CLIENT_SYSTEM/dataserver" || exit 2
|
|
create_dir_gameserver "$PATCH_CLIENT_SYSTEM/patch_game" || exit 2
|
|
create_dir_gameserver "$PATCH_CLIENT_SYSTEM/patch_game/bnp" || exit 2
|
|
create_dir_gameserver "$PATCH_CLIENT_SYSTEM/dataserver" || exit 2
|
|
create_dir_gameserver "$PATCH_CLIENT_SYSTEM/dataserver/data" || exit 2
|
|
create_dir_gameserver "$PATCH_CLIENT_SYSTEM/dataserver/data/kh" || exit 2
|
|
create_dir_gameserver "$PATCH_CLIENT_SYSTEM/dataserver/data/kh_shard" || exit 2
|
|
create_dir_gameserver "$PATCH_CLIENT_SYSTEM/dataserver/data/ryz" || exit 2
|
|
create_dir_gameserver "$PATCH_CLIENT_SYSTEM/dataserver/client" || exit 2
|
|
create_dir_gameserver "$KHANAT_HOME/khanat/prepare_client" || exit 2
|
|
create_dir_gameserver "$HOME_PREPARE_CLIENT" || exit 2
|
|
create_dir_gameserver "$HOME_PREPARE_CLIENT/data" || exit 2
|
|
create_dir_gameserver "$HOME_PREPARE_CLIENT/cfg" || exit 2
|
|
create_dir_gameserver "$HOME_PREPARE_CLIENT/save" || exit 2
|
|
create_dir_gameserver "$HOME_PREPARE_CLIENT/user" || exit 2
|
|
create_dir_gameserver "$HOME_PREPARE_CLIENT/cache" || exit 2
|
|
create_dir_gameserver "$HOME_CLIENT" || exit 2
|
|
|
|
create_dir_gameserver "$KHANAT_PATH/patch_service" || exit 2
|
|
create_dir_gameserver "$KHANAT_PATH/patch_service/patch_game" || exit 2
|
|
create_dir_gameserver "$KHANAT_PATH/patch_service/patch_game/patch" || exit 2
|
|
create_dir_gameserver "$KHANAT_PATH/khanatweb" || exit 2
|
|
|
|
msg_debug "Configure Log"
|
|
create_dir_gameserver '/home/gameserver/log/apache2' || exit 2
|
|
create_file_gameserver '/home/gameserver/log/apache2/access.log' || exit 2
|
|
create_file_gameserver '/home/gameserver/log/apache2/error.log' || exit 2
|
|
create_file_gameserver '/home/gameserver/log/apache2/other_vhosts_access.log' || exit 2
|
|
|
|
####################################
|
|
# Create link (like copy)
|
|
####################################
|
|
msg_debug "create link from ryzom-ressources"
|
|
create_recursive_link '/home/gameserver/ext/ryzom-ressources/server/data_shard' "$KHANAT_PATH/server/data_shard" || exit 2
|
|
|
|
create_recursive_link '/home/gameserver/ext/ryzom-ressources/common' "$KHANAT_PATH/server/common" || exit 2
|
|
#create_dir_gameserver "$KHANAT_PATH/server/common" || exit 2
|
|
#create_link_2nd_level "/home/gameserver/ext/ryzom-ressources/common/*" "$KHANAT_PATH/server/common/" || exit 2
|
|
|
|
create_recursive_link '/home/gameserver/ext/ryzom-ressources/client' "$KHANAT_PATH/server/client" || exit 2
|
|
#create_link '/home/gameserver/ext/ryzom-ressources/client' "$KHANAT_PATH/server/client" || exit 2
|
|
|
|
msg_debug "create link from khanat-ressources"
|
|
#create_recursive_link '/home/gameserver/ext/khanat-ressources/collisions' "$KHANAT_PATH/server/collisions" || exit 2
|
|
create_recursive_link '/home/gameserver/ext/khanat-ressources/leveldesign' "$KHANAT_PATH/server/leveldesign" || exit 2
|
|
#create_recursive_link '/home/gameserver/ext/khanat-ressources/primitives' "$KHANAT_PATH/server/primitives" || exit 2
|
|
create_recursive_link '/home/gameserver/ext/khanat-ressources/translation' "$KHANAT_PATH/server/translation" || exit 2
|
|
#create_recursive_link '/home/gameserver/ext/khanat-ressources/continents' "$KHANAT_PATH/server/continents" || exit 2
|
|
create_link '/home/gameserver/ext/khanat-ressources/collisions' "$KHANAT_PATH/server" || exit 2
|
|
#create_link '/home/gameserver/ext/khanat-ressources/leveldesign' "$KHANAT_PATH/server/leveldesign" || exit 2
|
|
create_link '/home/gameserver/ext/khanat-ressources/primitives' "$KHANAT_PATH/server" || exit 2
|
|
#create_link '/home/gameserver/ext/khanat-ressources/translation' "$KHANAT_PATH/server/translation" || exit 2
|
|
create_link '/home/gameserver/ext/khanat-ressources/continents' "$KHANAT_PATH/server" || exit 2
|
|
|
|
create_recursive_link '/home/gameserver/ext/khanat-ressources/common' "$KHANAT_PATH/server/common" || exit 2
|
|
#create_link_2nd_level "/home/gameserver/ext/khanat-ressources/common/*" "$KHANAT_PATH/server/common/" || exit 2
|
|
|
|
create_link '/home/gameserver/ext/khanat-ressources/shard/su/dev_gm_names.xml' "$KHANAT_PATH/server/data_shard" || exit 2
|
|
create_link '/home/gameserver/ext/khanat-ressources/shard/su/invalid_entity_names.txt' "$KHANAT_PATH/server/data_shard" || exit 2
|
|
create_link '/home/gameserver/ext/khanat-ressources/shard/su/reserved_names.xml' "$KHANAT_PATH/server/data_shard" || exit 2
|
|
create_link '/home/gameserver/ext/khanat-ressources/shard/egs/game_event.txt' "$KHANAT_PATH/server/data_shard" || exit 2
|
|
create_link '/home/gameserver/ext/khanat-ressources/shard/egs/mission_queues.txt' "$KHANAT_PATH/server/data_shard" || exit 2
|
|
create_link '/home/gameserver/ext/khanat-ressources/shard/egs/named_items.txt' "$KHANAT_PATH/server/data_shard" || exit 2
|
|
|
|
####################################
|
|
# Link configuration
|
|
####################################
|
|
msg_debug "create link configuration"
|
|
create_link_2nd_level "/home/gameserver/ext/ryzom-ressources/server/*.cfg" "$KHANAT_PATH/server" || exit 2
|
|
#for file in /home/gameserver/ext/ryzom-ressources/server/*.cfg
|
|
#do
|
|
# create_link "$file" "$KHANAT_PATH/server" || exit 2
|
|
#done
|
|
|
|
####################################
|
|
# Link tools script (shard)
|
|
####################################
|
|
msg_debug "create link (tools)"
|
|
create_dir_gameserver "$KHANAT_PATH/tools" || exit 2
|
|
create_dir_gameserver "$KHANAT_PATH/tools/scripts" || exit 2
|
|
create_dir_gameserver "$KHANAT_PATH/tools/scripts/linux" || exit 2
|
|
create_recursive_link '/home/gameserver/ext/ryzom-ressources/tools/scripts/linux' "$KHANAT_PATH/tools/scripts/linux" || exit 2
|
|
|
|
####################################
|
|
# Link tools khaganat
|
|
####################################
|
|
msg_debug "[$(basename $0):$LINENO] Link tools khaganat"
|
|
create_link '/opt/ext/khaganat.cfg' "$KHANAT_PATH"
|
|
|
|
####################################
|
|
# End
|
|
####################################
|
|
msg_info "[$(basename $0):$LINENO] => END"
|