update readme & update message

This commit is contained in:
AleaJactaEst 2017-11-22 21:13:50 +01:00
parent 8398afb454
commit 3d915f93b7
12 changed files with 296 additions and 210 deletions

View file

@ -18,6 +18,7 @@ Depend on your environment.
## Clone repo ## Clone repo
git clone https://git.khaganat.net/khaganat/mmorpg_khanat/khanat-server-docker.git
git clone https://git.khaganat.net/khaganat/mmorpg_khanat/khanat-opennel-code.git git clone https://git.khaganat.net/khaganat/mmorpg_khanat/khanat-opennel-code.git
git clone https://git.khaganat.net/khaganat/mmorpg_khanat/khanat-client-data.git git clone https://git.khaganat.net/khaganat/mmorpg_khanat/khanat-client-data.git
git clone https://git.khaganat.net/khaganat/mmorpg_khanat/khanat-ressources.git git clone https://git.khaganat.net/khaganat/mmorpg_khanat/khanat-ressources.git
@ -31,15 +32,18 @@ Depend on your environment.
command : command :
./builder/debian/jessie/x86_64/build.sh -c -r -j 4 -a '-DWITH_SYMBOLS=ON' -m '-m 20g' -d ``` sh
builder/debian/jessie/x86_64/build.sh -c -r -j 4 -a '-DWITH_SYMBOLS=ON' -m '-m 20g' -d
```
result: result:
package : ./code/build/builder_khanat_debian_jessie_x86_64/ryzomcore-*.tar.gz package : build/opennel/builder_debian_jessie_x86_64/ryzomcore-*.tar.gz
log build : ./code/build/builder_khanat_debian_jessie_x86_64/build.log log build : build/opennel/builder_debian_jessie_x86_64/build.log
all file generated on build : ./code/build/builder_khanat_debian_jessie_x86_64/ all file generated on build : build/opennel/builder_debian_jessie_x86_64/
@ -49,17 +53,73 @@ Compil server :
(prepare server / initialize khanat / database / patch) (prepare server / initialize khanat / database / patch)
./dist/docker/server/debian/jessie/x86_64/server.sh -b -t -q -z -k -n ``` sh
server/debian/jessie/x86_64/server.sh -b -t -q -z -k -n
```
Start server : Start server :
(You need tape Enter when application ask to start server) (You need tape Enter when application ask to start server)
./dist/docker/server/debian/jessie/x86_64/server.sh ``` sh
server/debian/jessie/x86_64/server.sh
```
Connect server with ssh (only if server is started) Connect server with ssh (only if server is started)
./dist/docker/server/debian/jessie/x86_64/server.sh --ssh ``` sh
server/debian/jessie/x86_64/server.sh --ssh
```
## BUILD ALL
To generate all architectures and all debian release
(build & generate server)
``` sh
build_all.sh
```
## DOCKER
### List image
``` sh
docker images
```
### List container
``` sh
docker ps -a
```
### Remove container
``` sh
docker rm <Container ID>
```
### Remove image
``` sh
docker rmi <Image ID>
```
### Launch container
Launch bash command
(if you exist on your command, it stop your container)
``` sh
docker run -it <Image ID or name> /bin/bash
```
### Save image
``` sh
docker save -o image.tar <Image ID>
```
### Load image
``` sh
docker load --input image.tar
```

View file

@ -24,6 +24,7 @@ declare -i BUILD_x86_64=0
declare -i GENERATE_CONTAINER_x86_64=0 declare -i GENERATE_CONTAINER_x86_64=0
declare -i GENERATE_IMAGE_x86_64=0 declare -i GENERATE_IMAGE_x86_64=0
declare -i CLEAN=0 declare -i CLEAN=0
declare -i SAVE_IMAGES=0
calldir="$(dirname $0)" calldir="$(dirname $0)"
basedir=$(cd $calldir; pwd) basedir=$(cd $calldir; pwd)
@ -44,6 +45,7 @@ options:
--generate-container-x86_64 : Generate container docker for x86_64 (share data with host) --generate-container-x86_64 : Generate container docker for x86_64 (share data with host)
--generate-image-x86_64 : Generate image docker for x86_64 (image have all opennel) --generate-image-x86_64 : Generate image docker for x86_64 (image have all opennel)
--clean : remove build & server data --clean : remove build & server data
--save-docker-images : save all docker images
EOF EOF
} }
@ -59,14 +61,20 @@ function msg_info()
{ {
msg="$(date "+%Y/%m/%d %H:%M:%S") INFO - $*" msg="$(date "+%Y/%m/%d %H:%M:%S") INFO - $*"
echo "$msg" echo "$msg"
if [[ -d ${basedir}/build ]]
then
echo "$msg" >> ${basedir}/build/state.log echo "$msg" >> ${basedir}/build/state.log
fi
} }
function msg_error() function msg_error()
{ {
msg="$(date "+%Y/%m/%d %H:%M:%S") ERROR - $*" msg="$(date "+%Y/%m/%d %H:%M:%S") ERROR - $*"
echo "$msg" echo "$msg"
if [[ -d ${basedir}/build ]]
then
echo "$msg" >> ${basedir}/build/state.log echo "$msg" >> ${basedir}/build/state.log
fi
exit 2 exit 2
} }
@ -115,6 +123,10 @@ do
CLEAN=1 CLEAN=1
shift shift
;; ;;
--save-docker-images)
SAVE_IMAGES=1
shift
;;
*) *)
usage usage
msg_error "options '$1' not recognize" msg_error "options '$1' not recognize"
@ -122,9 +134,8 @@ do
esac esac
done done
mkdir -p "${basedir}/build" msg_info "[$(basename $0):$LINENO] INIT"
msg_info "BEGIN" if [[ $AUTO -eq 1 ]]
if [[ $AUTO ]]
then then
BUILD_i686=1 BUILD_i686=1
GENERATE_CONTAINER_i686=1 GENERATE_CONTAINER_i686=1
@ -136,44 +147,59 @@ fi
if [[ $CLEAN -ne 0 ]] if [[ $CLEAN -ne 0 ]]
then then
msg_debug "CLEAN" msg_debug "[$(basename $0):$LINENO] CLEAN"
rm -rf $basedir/build $basedir/output || msg_error "CLEAN" rm -rf "$basedir/build" "$basedir/output" || msg_error "[$(basename $0):$LINENO] CLEAN"
fi fi
mkdir -p "${basedir}/build"
msg_info "[$(basename $0):$LINENO] BEGIN"
if [[ $BUILD_i686 -ne 0 ]] if [[ $BUILD_i686 -ne 0 ]]
then then
msg_debug "BUILD DEBIAN JESSIE i686" msg_debug "[$(basename $0):$LINENO] BUILD DEBIAN JESSIE i686"
builder/debian/jessie/i686/build.sh -c -j 12 -a '-DWITH_SSE2=OFF' -a '-DWITH_SYMBOLS=ON' -m '-m 20g' -d || msg_error "BUILD DEBIAN JESSIE i686" $basedir/builder/debian/jessie/i686/build.sh -c -j 12 -a '-DWITH_SSE2=OFF' -a '-DWITH_SYMBOLS=ON' -m '-m 20g' -d || msg_error "[$(basename $0):$LINENO] BUILD DEBIAN JESSIE i686"
fi fi
if [[ $GENERATE_CONTAINER_i686 -ne 0 ]] if [[ $GENERATE_CONTAINER_i686 -ne 0 ]]
then then
msg_debug "GENERATE SERVER CONTAINER DEBIAN JESSIE i686" msg_debug "[$(basename $0):$LINENO] GENERATE SERVER CONTAINER DEBIAN JESSIE i686"
server/debian/jessie/i686/server-container.sh -r -b -k -w -c -n || msg_error "GENERATE SERVER CONTAINER DEBIAN JESSIE i686" $basedir/server/debian/jessie/i686/server-container.sh -r -b -k -w -c -n || msg_error "[$(basename $0):$LINENO] GENERATE SERVER CONTAINER DEBIAN JESSIE i686"
fi fi
if [[ $GENERATE_IMAGE_i686 -ne 0 ]] if [[ $GENERATE_IMAGE_i686 -ne 0 ]]
then then
msg_debug "GENERATE SERVER IMAGE DEBIAN JESSIE i686" msg_debug "[$(basename $0):$LINENO] GENERATE SERVER IMAGE DEBIAN JESSIE i686"
server/debian/jessie/i686/server-image.sh -b -k -w -c -n || msg_error "GENERATE SERVER IMAGE DEBIAN JESSIE i686" $basedir/server/debian/jessie/i686/server-image.sh -b -k -w -c -n || msg_error "[$(basename $0):$LINENO] GENERATE SERVER IMAGE DEBIAN JESSIE i686"
fi fi
if [[ $BUILD_x86_64 -ne 0 ]] if [[ $BUILD_x86_64 -ne 0 ]]
then then
msg_debug "BUILD DEBIAN JESSIE x86_64" msg_debug "[$(basename $0):$LINENO] BUILD DEBIAN JESSIE x86_64"
builder/debian/jessie/x86_64/build.sh -c -j 12 -a '-DWITH_SYMBOLS=ON' -m '-m 20g' -d || msg_error "BUILD DEBIAN JESSIE x86_64" $basedir/builder/debian/jessie/x86_64/build.sh -c -j 12 -a '-DWITH_SYMBOLS=ON' -m '-m 20g' -d || msg_error "[$(basename $0):$LINENO] BUILD DEBIAN JESSIE x86_64"
fi fi
if [[ $GENERATE_CONTAINER_x86_64 -ne 0 ]] if [[ $GENERATE_CONTAINER_x86_64 -ne 0 ]]
then then
msg_debug "GENERATE SERVER CONTAINER DEBIAN JESSIE x86_64" msg_debug "[$(basename $0):$LINENO] GENERATE SERVER CONTAINER DEBIAN JESSIE x86_64"
server/debian/jessie/x86_64/server-container.sh -r -b -k -g -w -c -n || msg_error "GENERATE SERVER CONTAINER DEBIAN JESSIE x86_64" $basedir/server/debian/jessie/x86_64/server-container.sh -r -b -k -g -w -c -n || msg_error "[$(basename $0):$LINENO] GENERATE SERVER CONTAINER DEBIAN JESSIE x86_64"
fi fi
if [[ $GENERATE_IMAGE_x86_64 -ne 0 ]] if [[ $GENERATE_IMAGE_x86_64 -ne 0 ]]
then then
msg_debug "GENERATE SERVER IMAGE DEBIAN JESSIE x86_64" msg_debug "[$(basename $0):$LINENO] GENERATE SERVER IMAGE DEBIAN JESSIE x86_64"
server/debian/jessie/x86_64/server-image.sh -b -k -w -c -n || msg_error "GENERATE SERVER IMAGE DEBIAN JESSIE x86_64" $basedir/server/debian/jessie/x86_64/server-image.sh -b -k -w -c -n || msg_error "[$(basename $0):$LINENO] GENERATE SERVER IMAGE DEBIAN JESSIE x86_64"
fi
if [[ $SAVE_IMAGES -ne 0 ]]
then
mkdir -p $basedir/output/images || msg_error "[$(basename $0):$LINENO] Impossible to create $basedir/output/images"
listimages=( $(docker images --filter=reference='opennel/*' --format "{{.Repository}}") )
for image in ${listimages[@]}
do
mkdir -p $(dirname $basedir/output/images/$image) || msg_error "[$(basename $0):$LINENO] Impossible to create $(dirname $basedir/output/images/$image)"
docker save -o "$basedir/output/images/$image.tar" "$image" || msg_error "[$(basename $0):$LINENO] Impossible to save image $image"
done
fi fi
msg_info "END" msg_info "END"

View file

@ -287,7 +287,7 @@ fi
if [[ $CLEANIMAGENONE -ne 0 ]] if [[ $CLEANIMAGENONE -ne 0 ]]
then then
msg_info "CLEAN IMAGE DOCKER 'NONE'" msg_info "CLEAN IMAGE DOCKER 'NONE'"
listimages=( $(docker images | awk '{if ($1=="<none>")print $3}') ) listimages=( $(docker images --filter "dangling=true" --format "{{.ID}}") )
msg_debug "IMAGES NONE : ${listimages[@]}" msg_debug "IMAGES NONE : ${listimages[@]}"
if [[ -n "${listimages[@]}" ]] if [[ -n "${listimages[@]}" ]]

View file

@ -287,7 +287,7 @@ fi
if [[ $CLEANIMAGENONE -ne 0 ]] if [[ $CLEANIMAGENONE -ne 0 ]]
then then
msg_info "CLEAN IMAGE DOCKER 'NONE'" msg_info "CLEAN IMAGE DOCKER 'NONE'"
listimages=( $(docker images | awk '{if ($1=="<none>")print $3}') ) listimages=( $(docker images --filter "dangling=true" --format "{{.ID}}") )
msg_debug "IMAGES NONE : ${listimages[@]}" msg_debug "IMAGES NONE : ${listimages[@]}"
if [[ -n "${listimages[@]}" ]] if [[ -n "${listimages[@]}" ]]

View file

@ -268,7 +268,7 @@ fi
if [[ $CLEANIMAGENONE -ne 0 ]] if [[ $CLEANIMAGENONE -ne 0 ]]
then then
msg_info "CLEAN IMAGE DOCKER 'NONE'" msg_info "CLEAN IMAGE DOCKER 'NONE'"
listimages=( $(docker images | awk '{if ($1=="<none>")print $3}') ) listimages=( $(docker images --filter "dangling=true" --format "{{.ID}}") )
msg_debug "IMAGES NONE : ${listimages[@]}" msg_debug "IMAGES NONE : ${listimages[@]}"
if [[ -n "${listimages[@]}" ]] if [[ -n "${listimages[@]}" ]]

View file

@ -277,7 +277,7 @@ else
fi fi
fi fi
msg_info "[$(basename $0):$LINENO] CLIENT VERSION: $KHANAT_CLIENT_VERSION" msg_info "[$(basename $0):$LINENO] CLIENT VERSION SELECTED : $KHANAT_CLIENT_VERSION"
echo -n "$KHANAT_CLIENT_VERSION" > $PATCH_CLIENT_SYSTEM/patch_game/Lirria.version echo -n "$KHANAT_CLIENT_VERSION" > $PATCH_CLIENT_SYSTEM/patch_game/Lirria.version
#################################### ####################################
@ -294,7 +294,7 @@ msg_info "[$(basename $0):$LINENO] Edit release note"
# Added files for version # Added files for version
REALVERSION=$(awk '{if($0 ~ /patch_gen_common.cpp 330 addVersion <Unknown> : Added files for version:/){print $12}}' $KHANAT_HOME/log/configure/patch_${KHANAT_CLIENT_VERSION}_updateProduct.out) REALVERSION=$(awk '{if($0 ~ /patch_gen_common.cpp 330 addVersion <Unknown> : Added files for version:/){print $12}}' $KHANAT_HOME/log/configure/patch_${KHANAT_CLIENT_VERSION}_updateProduct.out)
msg_info "CLIENT VERSION: $REALVERSION" msg_info "[$(basename $0):$LINENO] CLIENT VERSION REAL: $REALVERSION"
cat << EOF > $PATCH_CLIENT_SYSTEM/patch_game/patch/index.php cat << EOF > $PATCH_CLIENT_SYSTEM/patch_game/patch/index.php
<html> <html>
<head> <head>

View file

@ -52,7 +52,7 @@ function msg_error()
# MAIN # MAIN
##################### #####################
source /opt/ext/servercontainer_function.sh source /opt/ext/servercontainer_function.sh
msg_info "$(basename $0) => START" msg_info "[$(basename $0):$LINENO] => START"
while test $# -gt 0 while test $# -gt 0
do do
@ -76,17 +76,17 @@ done
#################################### ####################################
# Load Environment # Load Environment
#################################### ####################################
msg_debug "Load environment" msg_debug "[$(basename $0):$LINENO] Load environment"
if [[ ! -f /opt/khanat_config.sh ]] if [[ ! -f /opt/khanat_config.sh ]]
then then
echo "ERROR - missing /opt/khanat_config.sh" echo "ERROR [$(basename $0):$LINENO] missing /opt/khanat_config.sh"
exit 2 exit 2
fi fi
source /opt/khanat_config.sh source /opt/khanat_config.sh
if [[ ! -f /home/gameserver/.bashrc ]] if [[ ! -f /home/gameserver/.bashrc ]]
then then
msg_error "Missing /home/gameserver/.bashrc" msg_error "[$(basename $0):$LINENO] Missing /home/gameserver/.bashrc"
exit 2 exit 2
fi fi
source /home/gameserver/.bashrc source /home/gameserver/.bashrc
@ -95,12 +95,12 @@ source /home/gameserver/.bashrc
#################################### ####################################
# Start mysql & apache # Start mysql & apache
#################################### ####################################
msg_debug "Start mysql" msg_debug "[$(basename $0):$LINENO] Start mysql"
# start/restart service mysql & apache # start/restart service mysql & apache
sudo service mysql start || exit 2 sudo service mysql start || exit 2
# Wait mysql start # Wait mysql start
msg_info "Check database is started" msg_info "[$(basename $0):$LINENO] Check database is started"
sleep 1 sleep 1
until sudo /usr/bin/mysqladmin ping >/dev/null 2>&1 until sudo /usr/bin/mysqladmin ping >/dev/null 2>&1
do do
@ -117,7 +117,7 @@ sudo service apache2 start || exit 2
#################################### ####################################
# Create account # Create account
#################################### ####################################
msg_debug "Create account" msg_debug "[$(basename $0):$LINENO] Create account"
# Create account shard on MySQL # Create account shard on MySQL
mysql -u root -e "CREATE USER 'shard'@'localhost' IDENTIFIED BY '';" || exit 2 mysql -u root -e "CREATE USER 'shard'@'localhost' IDENTIFIED BY '';" || exit 2
mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO 'shard'@'localhost' WITH GRANT OPTION;" || exit 2 mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO 'shard'@'localhost' WITH GRANT OPTION;" || exit 2
@ -126,7 +126,7 @@ mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO 'shard'@'localhost' WITH GRANT
#################################### ####################################
# launch web configuration for khanat # launch web configuration for khanat
#################################### ####################################
msg_debug "launch web configuration for khanat" msg_debug "[$(basename $0):$LINENO] launch web configuration for khanat"
curl 'http://localhost:40916/setup/install.php' \ curl 'http://localhost:40916/setup/install.php' \
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' \ -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' \
-H 'Accept-Language: en-US' \ -H 'Accept-Language: en-US' \
@ -179,7 +179,7 @@ export addressip=${tmp//[[:blank:]]/}
#################################### ####################################
## Configure Domain ## Configure Domain
#################################### ####################################
msg_debug "Configure Domain" msg_debug "[$(basename $0):$LINENO] Configure Domain"
mysql -u root -e "use nel; mysql -u root -e "use nel;
INSERT INTO nel.domain (domain_id, domain_name, status, patch_version, backup_patch_url, patch_urls, login_address, session_manager_address, ring_db_name, web_host, web_host_php, description) VALUES ('12', 'Lirria', 'ds_open', '$KHANAT_CLIENT_VERSION', '$addressip:23001', '$addressip/patch', '$addressip:49998', '$addressip:49999', 'ring_mini01', '$addressip:30000', '$addressip:40916', NULL);" || exit 2 INSERT INTO nel.domain (domain_id, domain_name, status, patch_version, backup_patch_url, patch_urls, login_address, session_manager_address, ring_db_name, web_host, web_host_php, description) VALUES ('12', 'Lirria', 'ds_open', '$KHANAT_CLIENT_VERSION', '$addressip:23001', '$addressip/patch', '$addressip:49998', '$addressip:49999', 'ring_mini01', '$addressip:30000', '$addressip:40916', NULL);" || exit 2
@ -187,14 +187,14 @@ INSERT INTO nel.domain (domain_id, domain_name, status, patch_version, backup_pa
#################################### ####################################
# Configure nel.shard # Configure nel.shard
#################################### ####################################
msg_debug "Configure nel.shard" msg_debug "[$(basename $0):$LINENO] Configure nel.shard"
mysql -u root -e "use nel; mysql -u root -e "use nel;
INSERT INTO nel.shard (ShardId, domain_id, WsAddr, NbPlayers, Name, Online, Version, FixedSessionId, State, MOTD) VALUES ('302', '12', '$addressip:', '0', 'Lirria shard', '0', '', '0', 'ds_open', '');" || exit 2 INSERT INTO nel.shard (ShardId, domain_id, WsAddr, NbPlayers, Name, Online, Version, FixedSessionId, State, MOTD) VALUES ('302', '12', '$addressip:', '0', 'Lirria shard', '0', '', '0', 'ds_open', '');" || exit 2
#################################### ####################################
# Configure nel_tool.neltool_domains # Configure nel_tool.neltool_domains
#################################### ####################################
msg_debug "Configure nel_tool.neltool_domains" msg_debug "[$(basename $0):$LINENO] Configure nel_tool.neltool_domains"
mysql -u root -e "use nel; mysql -u root -e "use nel;
INSERT INTO nel_tool.neltool_domains (domain_id, domain_name, domain_as_host, domain_as_port, domain_rrd_path, domain_las_admin_path, domain_las_local_path, domain_application, domain_sql_string, domain_hd_check, domain_mfs_web, domain_cs_sql_string) VALUES ('12', 'Lirria', '$addressip', '46700', '/home/gameserver/khanat/server/save_shard/rrd_graphs', '', '', 'ryzom_open', '', '0', NULL, NULL);" || exit 2 INSERT INTO nel_tool.neltool_domains (domain_id, domain_name, domain_as_host, domain_as_port, domain_rrd_path, domain_las_admin_path, domain_las_local_path, domain_application, domain_sql_string, domain_hd_check, domain_mfs_web, domain_cs_sql_string) VALUES ('12', 'Lirria', '$addressip', '46700', '/home/gameserver/khanat/server/save_shard/rrd_graphs', '', '', 'ryzom_open', '', '0', NULL, NULL);" || exit 2
@ -202,7 +202,7 @@ INSERT INTO nel_tool.neltool_domains (domain_id, domain_name, domain_as_host, do
#################################### ####################################
# configure nel_tool.neltool_shards # configure nel_tool.neltool_shards
#################################### ####################################
msg_debug "Configure nel_tool.neltool_shards" msg_debug "[$(basename $0):$LINENO] Configure nel_tool.neltool_shards"
mysql -u root -e "use nel; mysql -u root -e "use nel;
INSERT INTO nel_tool.neltool_shards (shard_id, shard_name, shard_as_id, shard_domain_id, shard_lang, shard_restart) VALUES ('302', 'open', 'open', '12', 'fr', '0');" || exit 2 INSERT INTO nel_tool.neltool_shards (shard_id, shard_name, shard_as_id, shard_domain_id, shard_lang, shard_restart) VALUES ('302', 'open', 'open', '12', 'fr', '0');" || exit 2
@ -210,7 +210,7 @@ INSERT INTO nel_tool.neltool_shards (shard_id, shard_name, shard_as_id, shard_do
#################################### ####################################
# configure nel_tool.neltool_user_domains # configure nel_tool.neltool_user_domains
#################################### ####################################
msg_debug "Configure nel_tool.neltool_user_domains" msg_debug "[$(basename $0):$LINENO] Configure nel_tool.neltool_user_domains"
mysql -u root -e "use nel; mysql -u root -e "use nel;
INSERT INTO nel_tool.neltool_user_domains (user_domain_id, user_domain_user_id, user_domain_domain_id) VALUES ('1', '1', '12');" || exit 2 INSERT INTO nel_tool.neltool_user_domains (user_domain_id, user_domain_user_id, user_domain_domain_id) VALUES ('1', '1', '12');" || exit 2
@ -218,7 +218,7 @@ INSERT INTO nel_tool.neltool_user_domains (user_domain_id, user_domain_user_id,
#################################### ####################################
# configure nel_tool.neltool_user_shards # configure nel_tool.neltool_user_shards
#################################### ####################################
msg_debug "Configure nel_tool.neltool_user_shards" msg_debug "[$(basename $0):$LINENO] Configure nel_tool.neltool_user_shards"
mysql -u root -e "use nel; mysql -u root -e "use nel;
INSERT INTO nel_tool.neltool_user_shards (user_shard_id, user_shard_user_id, user_shard_shard_id, user_shard_domain_id) VALUES ('1', '1', '302', '12');" || exit 2 INSERT INTO nel_tool.neltool_user_shards (user_shard_id, user_shard_user_id, user_shard_shard_id, user_shard_domain_id) VALUES ('1', '1', '302', '12');" || exit 2
@ -226,7 +226,7 @@ INSERT INTO nel_tool.neltool_user_shards (user_shard_id, user_shard_user_id, use
#################################### ####################################
# configure ring_mini01.sessions # configure ring_mini01.sessions
#################################### ####################################
msg_debug "Configure ring_mini01.sessions" msg_debug "[$(basename $0):$LINENO] Configure ring_mini01.sessions"
mysql -u root -e "use ring_mini01; mysql -u root -e "use ring_mini01;
INSERT INTO ring_mini01.sessions (session_id, session_type, title, owner, plan_date, start_date, description, orientation, level, rule_type, access_type, state, host_shard_id, subscription_slots, reserved_slots, free_slots, estimated_duration, final_duration, folder_id, lang, icone, anim_mode, race_filter, religion_filter, guild_filter, shard_filter, level_filter, subscription_closed, newcomer) VALUES ('302', 'st_mainland', '', '0', '2005-09-21 12:41:33.000000', '2005-08-31 00:00:00.000000', '', 'so_other', 'sl_a', 'rt_strict', 'at_private', 'ss_planned', '0', '0', '0', '0', 'et_short', '0', '0', '', '', 'am_dm', '', '', 'gf_only_my_guild', 'sf_shard00,sf_shard01,sf_shard02,sf_shard03,sf_shard04,sf_shard05,sf_shard06,sf_shard07,sf_shard08,sf_shard09,sf_shard10,sf_shard11,sf_shard12,sf_shard13,sf_shard14,sf_shard15,sf_shard16,sf_shard17,sf_shard18,sf_shard19,sf_shard20,sf_shard21,sf_shard22,sf_shard23,sf_shard24,sf_shard25,sf_shard26,sf_shard27,sf_shard28,sf_shard29,sf_shard30', 'lf_a,lf_b,lf_c,lf_d,lf_e,lf_f', '0', '0');" || exit 2 INSERT INTO ring_mini01.sessions (session_id, session_type, title, owner, plan_date, start_date, description, orientation, level, rule_type, access_type, state, host_shard_id, subscription_slots, reserved_slots, free_slots, estimated_duration, final_duration, folder_id, lang, icone, anim_mode, race_filter, religion_filter, guild_filter, shard_filter, level_filter, subscription_closed, newcomer) VALUES ('302', 'st_mainland', '', '0', '2005-09-21 12:41:33.000000', '2005-08-31 00:00:00.000000', '', 'so_other', 'sl_a', 'rt_strict', 'at_private', 'ss_planned', '0', '0', '0', '0', 'et_short', '0', '0', '', '', 'am_dm', '', '', 'gf_only_my_guild', 'sf_shard00,sf_shard01,sf_shard02,sf_shard03,sf_shard04,sf_shard05,sf_shard06,sf_shard07,sf_shard08,sf_shard09,sf_shard10,sf_shard11,sf_shard12,sf_shard13,sf_shard14,sf_shard15,sf_shard16,sf_shard17,sf_shard18,sf_shard19,sf_shard20,sf_shard21,sf_shard22,sf_shard23,sf_shard24,sf_shard25,sf_shard26,sf_shard27,sf_shard28,sf_shard29,sf_shard30', 'lf_a,lf_b,lf_c,lf_d,lf_e,lf_f', '0', '0');" || exit 2
@ -234,7 +234,7 @@ INSERT INTO ring_mini01.sessions (session_id, session_type, title, owner, plan_d
#################################### ####################################
## Create one user 'tester' (password : tester) ## Create one user 'tester' (password : tester)
#################################### ####################################
msg_debug "Create one user" msg_debug "[$(basename $0):$LINENO] Create one user"
declare accountuser="tester" declare accountuser="tester"
declare passworduser="tester" declare passworduser="tester"
curl 'http://localhost:40916/ams/index.php' \ curl 'http://localhost:40916/ams/index.php' \
@ -255,7 +255,7 @@ curl 'http://localhost:40916/ams/index.php' \
#################################### ####################################
# configure nel.permission # configure nel.permission
#################################### ####################################
msg_debug "Create nel.permission" msg_debug "[$(basename $0):$LINENO] Create nel.permission"
mysql -u root -e "use nel; mysql -u root -e "use nel;
UPDATE nel.permission SET AccessPrivilege = 'OPEN,DEV,RESTRICTED'; UPDATE nel.permission SET AccessPrivilege = 'OPEN,DEV,RESTRICTED';
" || exit 2 " || exit 2
@ -264,7 +264,7 @@ UPDATE nel.permission SET AccessPrivilege = 'OPEN,DEV,RESTRICTED';
#################################### ####################################
# Stop Database & apache # Stop Database & apache
#################################### ####################################
msg_debug "Stop Database & apache" msg_debug "[$(basename $0):$LINENO] Stop Database & apache"
# start/restart service mysql & apache # start/restart service mysql & apache
sudo service apache2 stop || exit 2 sudo service apache2 stop || exit 2
sudo service mysql stop || exit 2 sudo service mysql stop || exit 2
@ -276,5 +276,5 @@ chown_gameserver "$KHANAT_HOME/database/mysql_upgrade_info"
#################################### ####################################
# End # End
#################################### ####################################
msg_info "$(basename $0) => END" msg_info "[$(basename $0):$LINENO] => END"

View file

@ -87,7 +87,7 @@ done
msg_debug "[$(basename $0):$LINENO] Load environment" msg_debug "[$(basename $0):$LINENO] Load environment"
if [[ ! -f /opt/khanat_config.sh ]] if [[ ! -f /opt/khanat_config.sh ]]
then then
echo "ERROR - missing /opt/khanat_config.sh" echo "ERROR - [$(basename $0):$LINENO] missing /opt/khanat_config.sh"
exit 2 exit 2
fi fi
source /opt/khanat_config.sh source /opt/khanat_config.sh

View file

@ -235,7 +235,7 @@ do
shift shift
;; ;;
*) *)
msg_error "options '$1' not recognize" msg_error "[$(basename $0):$LINENO] options '$1' not recognize"
usage usage
exit 1 exit 1
;; ;;
@ -244,7 +244,7 @@ done
function chrashed() function chrashed()
{ {
msg_error "BUILD FAILED (code:$?)" msg_error "[$(basename $0):$LINENO] BUILD FAILED (code:$?)"
exit 2 exit 2
} }
@ -252,15 +252,15 @@ trap chrashed EXIT
if [[ $SHOWIPKHANATSERVER -eq 0 ]] if [[ $SHOWIPKHANATSERVER -eq 0 ]]
then then
msg_info "START" msg_info "[$(basename $0):$LINENO] START"
fi fi
msg_debug "prg: $0" msg_debug "[$(basename $0):$LINENO] prg: $0"
docker -v 1>/dev/null docker -v 1>/dev/null
if [[ $? -ne 0 ]] if [[ $? -ne 0 ]]
then then
msg_error "docker not installed" msg_error "[$(basename $0):$LINENO] docker not installed"
exit 2 exit 2
fi fi
@ -270,28 +270,28 @@ case "$(uname -m)" in
i686) i686)
;; ;;
*) *)
msg_error "Unknown archi : $(uname -m)" msg_error "[$(basename $0):$LINENO] Unknown archi : $(uname -m)"
exit 2 exit 2
;; ;;
esac esac
if [[ $REMOVE -ne 0 ]] if [[ $REMOVE -ne 0 ]]
then then
msg_info "REMOVE DATA KHANAT : $ROOTDATAKHANAT" msg_info "[$(basename $0):$LINENO] REMOVE DATA KHANAT : $ROOTDATAKHANAT"
if [[ -n "$ROOTDATAKHANAT" ]] if [[ -n "$ROOTDATAKHANAT" ]]
then then
rm -rf ${ROOTDATAKHANAT}/* || exit 2 rm -rf ${ROOTDATAKHANAT}/* || exit 2
fi fi
fi fi
msg_debug "Create directory on host ($ROOTDATAKHANAT)" msg_debug "[$(basename $0):$LINENO] Create directory on host ($ROOTDATAKHANAT)"
mkdir -p $ROOTDATAKHANAT || exit 2 mkdir -p $ROOTDATAKHANAT || exit 2
chmod g+s $ROOTDATAKHANAT chmod g+s $ROOTDATAKHANAT
if [[ ($CONNECTSSHKHANAT -ne 0) || ($SHOWIPKHANATSERVER -ne 0) ]] if [[ ($CONNECTSSHKHANAT -ne 0) || ($SHOWIPKHANATSERVER -ne 0) ]]
then then
msg_debug "clean container" msg_debug "[$(basename $0):$LINENO] clean container"
listcontainer="$(docker ps -qf 'status=running' -f 'ancestor='"${IMAGEKHANATSERVER}"'')" listcontainer="$(docker ps -qf 'status=running' -f 'ancestor='"${IMAGEKHANATSERVER}"'')"
if [[ ${#listcontainer[@]} -eq 1 ]] if [[ ${#listcontainer[@]} -eq 1 ]]
then then
@ -310,13 +310,13 @@ if [[ $CONNECTSSHKHANAT -ne 0 ]]
then then
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no gameserver@$ipaddress ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no gameserver@$ipaddress
trap '' EXIT trap '' EXIT
msg_info "END SSH" msg_info "[$(basename $0):$LINENO] END SSH"
exit 0 exit 0
fi fi
if [[ $AUTODETEC -ne 0 ]] if [[ $AUTODETEC -ne 0 ]]
then then
msg_debug "Autodetect state" msg_debug "[$(basename $0):$LINENO] Autodetect state"
if [[ $(docker images -f "reference=$IMAGEGENERICSERVER" | wc -l) -lt 2 ]] if [[ $(docker images -f "reference=$IMAGEGENERICSERVER" | wc -l) -lt 2 ]]
then then
BASICSERVER=1 BASICSERVER=1
@ -345,22 +345,22 @@ fi
DIRBUILD="${rootdir}/${LOCALBUILDDIR}" DIRBUILD="${rootdir}/${LOCALBUILDDIR}"
msg_debug "calldir: $calldir" msg_debug "[$(basename $0):$LINENO] calldir: $calldir"
msg_debug "basedir: $basedir" msg_debug "[$(basename $0):$LINENO] basedir: $basedir"
msg_debug "rootdir: $rootdir" msg_debug "[$(basename $0):$LINENO] rootdir: $rootdir"
msg_debug "ressourcedir: $ressourcedir" msg_debug "[$(basename $0):$LINENO] ressourcedir: $ressourcedir"
msg_debug "generate basic image: $BASICSERVER" msg_debug "[$(basename $0):$LINENO] generate basic image: $BASICSERVER"
msg_debug "localization khanat-ressources : ${KHANAT_RESSOURCES_DIR}" msg_debug "[$(basename $0):$LINENO] localization khanat-ressources : ${KHANAT_RESSOURCES_DIR}"
msg_debug "localization khanat-client-data: ${KHANAT_CLIENT_DATA_DIR}" msg_debug "[$(basename $0):$LINENO] localization khanat-client-data: ${KHANAT_CLIENT_DATA_DIR}"
msg_debug "localization opennel-code-client : ${OPENNEL_CODE_DIR}" msg_debug "[$(basename $0):$LINENO] localization opennel-code-client : ${OPENNEL_CODE_DIR}"
msg_debug "generate khanat image: $KHANATSERVER" msg_debug "[$(basename $0):$LINENO] generate khanat image: $KHANATSERVER"
msg_debug "launch khanat: $LAUNCHKHANAT" msg_debug "[$(basename $0):$LINENO] launch khanat: $LAUNCHKHANAT"
msg_debug "stop khanat: $STOPKHANAT" msg_debug "[$(basename $0):$LINENO] stop khanat: $STOPKHANAT"
msg_info "check khanat-ressources" msg_info "[$(basename $0):$LINENO] check khanat-ressources"
if [[ ! -d ${KHANAT_RESSOURCES_DIR} ]] if [[ ! -d ${KHANAT_RESSOURCES_DIR} ]]
then then
msg_error "Missing directory khanat-ressources [${KHANAT_RESSOURCES_DIR}]" msg_error "[$(basename $0):$LINENO] Missing directory khanat-ressources [${KHANAT_RESSOURCES_DIR}]"
cat << EOF cat << EOF
You need clone repo khanat-ressource. You need clone repo khanat-ressource.
@ -372,10 +372,10 @@ EOF
fi fi
msg_info "check khanat-client-data" msg_info "[$(basename $0):$LINENO] check khanat-client-data"
if [[ ! -d ${KHANAT_CLIENT_DATA_DIR} ]] if [[ ! -d ${KHANAT_CLIENT_DATA_DIR} ]]
then then
msg_error "Missing directory khanat-client-data [${KHANAT_CLIENT_DATA_DIR}]" msg_error "[$(basename $0):$LINENO] Missing directory khanat-client-data [${KHANAT_CLIENT_DATA_DIR}]"
cat << EOF cat << EOF
You need clone repo khanat-client-data. You need clone repo khanat-client-data.
@ -388,7 +388,7 @@ fi
if [[ ! -d ${OPENNEL_CODE_DIR} ]] if [[ ! -d ${OPENNEL_CODE_DIR} ]]
then then
msg_error "Missing directory opennel-code [${OPENNEL_CODE_DIR}]" msg_error "[$(basename $0):$LINENO] Missing directory opennel-code [${OPENNEL_CODE_DIR}]"
cat << EOF cat << EOF
You need clone repo khanat-opennel-code. You need clone repo khanat-opennel-code.
@ -400,9 +400,9 @@ EOF
fi fi
if [[ $STOPKHANAT -ne 0 ]] if [[ $STOPKHANAT -ne 0 ]]
then then
msg_info "STOP SERVER KHANAT" msg_info "[$(basename $0):$LINENO] STOP SERVER KHANAT"
listcontainer="$(docker ps -qf 'status=running' -f 'ancestor='"${IMAGEKHANATSERVER}"'')" listcontainer="$(docker ps -qf 'status=running' -f 'ancestor='"${IMAGEKHANATSERVER}"'')"
msg_debug "CONTAINER KHANAT UP : ${listcontainer[@]}" msg_debug "[$(basename $0):$LINENO] CONTAINER KHANAT UP : ${listcontainer[@]}"
if [[ -n "$listcontainer" ]] if [[ -n "$listcontainer" ]]
then then
docker stop "$listcontainer" || exit 2 docker stop "$listcontainer" || exit 2
@ -411,9 +411,9 @@ fi
if [[ $CLEANCONTAINERKHANAT -ne 0 ]] if [[ $CLEANCONTAINERKHANAT -ne 0 ]]
then then
msg_info "CLEAN CONTAINER KHANAT" msg_info "[$(basename $0):$LINENO] CLEAN CONTAINER KHANAT"
listcontainer=( $(docker ps -qf 'status=exited' -f 'ancestor='"${IMAGEKHANATSERVER}"'') ) listcontainer=( $(docker ps -qf 'status=exited' -f 'ancestor='"${IMAGEKHANATSERVER}"'') )
msg_debug "CONTAINER KHANAT EXITED : ${listcontainer[@]}" msg_debug "[$(basename $0):$LINENO] CONTAINER KHANAT EXITED : ${listcontainer[@]}"
if [[ -n "${listcontainer[@]}" ]] if [[ -n "${listcontainer[@]}" ]]
then then
docker rm --force "${listcontainer[@]}" || exit 2 docker rm --force "${listcontainer[@]}" || exit 2
@ -422,10 +422,10 @@ fi
if [[ $CLEANIMAGENONE -ne 0 ]] if [[ $CLEANIMAGENONE -ne 0 ]]
then then
msg_info "CLEAN IMAGE DOCKER 'NONE'" msg_info "[$(basename $0):$LINENO] CLEAN IMAGE DOCKER 'NONE'"
listimages=( $(docker images | awk '{if ($1=="<none>")print $3}') ) listimages=( $(docker images --filter "dangling=true" --format "{{.ID}}") )
msg_debug "IMAGES NONE : ${listimages[@]}" msg_debug "[$(basename $0):$LINENO] IMAGES NONE : ${listimages[@]}"
if [[ -n "${listimages[@]}" ]] if [[ -n "${listimages[@]}" ]]
then then
docker rmi --force "${listimages[@]}" || exit 2 docker rmi --force "${listimages[@]}" || exit 2
@ -434,14 +434,14 @@ fi
if [[ $BASICSERVER -ne 0 ]] if [[ $BASICSERVER -ne 0 ]]
then then
msg_info "GENERATE DOCKER IMAGE BASIC SERVER" msg_info "[$(basename $0):$LINENO] GENERATE DOCKER IMAGE BASIC SERVER"
cd $rootdir; docker build . ${DOCKERBUILDOPT} -t ${IMAGEGENERICSERVER} \ cd $rootdir; docker build . ${DOCKERBUILDOPT} -t ${IMAGEGENERICSERVER} \
--file "${basedir}/Dockerfile" || exit 2 --file "${basedir}/Dockerfile" || exit 2
fi fi
if [[ $KHANATSERVER -ne 0 ]] if [[ $KHANATSERVER -ne 0 ]]
then then
msg_info "GENERATE DOCKER IMAGE KHANAT SERVER" msg_info "[$(basename $0):$LINENO] GENERATE DOCKER IMAGE KHANAT SERVER"
cat << EOF > $rootdir/${ENVIFILE} cat << EOF > $rootdir/${ENVIFILE}
#!/bin/bash #!/bin/bash
# Temporary file, use only to send some information on build docker # Temporary file, use only to send some information on build docker
@ -457,10 +457,10 @@ fi
if [[ $CONFIGUREKHANATSERVER -ne 0 ]] if [[ $CONFIGUREKHANATSERVER -ne 0 ]]
then then
msg_info "CONFIGURE KHANAT SERVER" msg_info "[$(basename $0):$LINENO] CONFIGURE KHANAT SERVER"
mkdir -p $DIRLOG || exit 2 mkdir -p $DIRLOG || exit 2
mkdir -p $DIRDATABASE || exit 2 mkdir -p $DIRDATABASE || exit 2
msg_debug "command : cd $rootdir; docker run -it --hostname=khanat \ msg_debug "[$(basename $0):$LINENO] command : cd $rootdir; docker run -it --hostname=khanat \
-v /etc/localtime:/etc/localtime:ro \ -v /etc/localtime:/etc/localtime:ro \
-v ${rootdir}/${LOCALBUILDDIR}/bin:/usr/local/bin:ro \ -v ${rootdir}/${LOCALBUILDDIR}/bin:/usr/local/bin:ro \
-v ${OPENNEL_CODE_DIR}/code/web/:/home/gameserver/ext/khanatweb:ro \ -v ${OPENNEL_CODE_DIR}/code/web/:/home/gameserver/ext/khanatweb:ro \
@ -488,8 +488,8 @@ fi
if [[ $UPDATEDATA -ne 0 ]] if [[ $UPDATEDATA -ne 0 ]]
then then
msg_info "UPDATE KHANAT SERVER" msg_info "[$(basename $0):$LINENO] UPDATE KHANAT SERVER"
msg_debug "command: cd $rootdir; docker run -it --hostname=khanat \ msg_debug "[$(basename $0):$LINENO] command: cd $rootdir; docker run -it --hostname=khanat \
-v /etc/localtime:/etc/localtime:ro \ -v /etc/localtime:/etc/localtime:ro \
-v ${rootdir}/${LOCALBUILDDIR}/bin:/usr/local/bin:ro \ -v ${rootdir}/${LOCALBUILDDIR}/bin:/usr/local/bin:ro \
-v ${OPENNEL_CODE_DIR}/code/web/:/home/gameserver/ext/khanatweb:ro \ -v ${OPENNEL_CODE_DIR}/code/web/:/home/gameserver/ext/khanatweb:ro \
@ -517,7 +517,7 @@ fi
if [[ $LAUNCHKHANAT -ne 0 ]] if [[ $LAUNCHKHANAT -ne 0 ]]
then then
msg_info "START KHANAT SERVER" msg_info "[$(basename $0):$LINENO] START KHANAT SERVER"
cd $rootdir; docker run -it --hostname=khanat \ cd $rootdir; docker run -it --hostname=khanat \
-u "$(id -u $USERNAME):$(id -g $USERNAME)" \ -u "$(id -u $USERNAME):$(id -g $USERNAME)" \
-v /etc/localtime:/etc/localtime:ro \ -v /etc/localtime:/etc/localtime:ro \
@ -534,4 +534,4 @@ then
fi fi
trap '' EXIT trap '' EXIT
msg_info "END" msg_info "[$(basename $0):$LINENO] END"

View file

@ -196,7 +196,7 @@ do
shift shift
;; ;;
*) *)
msg_error "options '$1' not recognize" msg_error "[$(basename $0):$LINENO] options '$1' not recognize"
usage usage
exit 1 exit 1
;; ;;
@ -205,7 +205,7 @@ done
function chrashed() function chrashed()
{ {
msg_error "BUILD FAILED (code:$?)" msg_error "[$(basename $0):$LINENO] BUILD FAILED (code:$?)"
exit 2 exit 2
} }
@ -213,10 +213,10 @@ trap chrashed EXIT
if [[ $SHOWIPKHANATSERVER -eq 0 ]] if [[ $SHOWIPKHANATSERVER -eq 0 ]]
then then
msg_info "START" msg_info "[$(basename $0):$LINENO] START"
fi fi
msg_debug "prg: $0" msg_debug "[$(basename $0):$LINENO] prg: $0"
extradir="${rootdir}/${DIROUTPUT}" extradir="${rootdir}/${DIROUTPUT}"
mkdir -p ${extradir} || exit 2 mkdir -p ${extradir} || exit 2
@ -225,7 +225,7 @@ mkdir -p ${extradir} || exit 2
docker -v 1>/dev/null docker -v 1>/dev/null
if [[ $? -ne 0 ]] if [[ $? -ne 0 ]]
then then
msg_error "docker not installed" msg_error "[$(basename $0):$LINENO] docker not installed"
exit 2 exit 2
fi fi
@ -235,7 +235,7 @@ case "$(uname -m)" in
i686) i686)
;; ;;
*) *)
msg_error "Unknown archi : $(uname -m)" msg_error "[$(basename $0):$LINENO] Unknown archi : $(uname -m)"
exit 2 exit 2
;; ;;
esac esac
@ -260,7 +260,7 @@ if [[ $CONNECTSSHKHANAT -ne 0 ]]
then then
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no gameserver@$ipaddress ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no gameserver@$ipaddress
trap '' EXIT trap '' EXIT
msg_info "END SSH" msg_info "[$(basename $0):$LINENO] END SSH"
exit 0 exit 0
fi fi
@ -299,10 +299,10 @@ then
sumsrc=1 sumsrc=1
sumdsr=2 sumdsr=2
fi fi
msg_debug "ryzomcore checksum src:$sumsrc dst:$sumdst" msg_debug "[$(basename $0):$LINENO] ryzomcore checksum src:$sumsrc dst:$sumdst"
if [[ "$sumsrc" != "$sumdst" ]] if [[ "$sumsrc" != "$sumdst" ]]
then then
msg_debug "copy ryzomcore" msg_debug "[$(basename $0):$LINENO] copy ryzomcore"
cp ${rootdir}/${LOCALBUILDDIR}/ryzomcore-0.12.0..tar.gz ${extradir}/ryzomcore.tar.gz || exit 2 cp ${rootdir}/${LOCALBUILDDIR}/ryzomcore-0.12.0..tar.gz ${extradir}/ryzomcore.tar.gz || exit 2
KHANATSERVER=1 KHANATSERVER=1
fi fi
@ -310,21 +310,21 @@ fi
DIRBUILD="${rootdir}/${LOCALBUILDDIR}" DIRBUILD="${rootdir}/${LOCALBUILDDIR}"
msg_debug "calldir: $calldir" msg_debug "[$(basename $0):$LINENO] calldir: $calldir"
msg_debug "basedir: $basedir" msg_debug "[$(basename $0):$LINENO] basedir: $basedir"
msg_debug "rootdir: $rootdir" msg_debug "[$(basename $0):$LINENO] rootdir: $rootdir"
msg_debug "ressourcedir: $ressourcedir" msg_debug "[$(basename $0):$LINENO] ressourcedir: $ressourcedir"
msg_debug "generate basic image: $BASICSERVER" msg_debug "[$(basename $0):$LINENO] generate basic image: $BASICSERVER"
msg_debug "generate tar khanat ressources: $KHANATRESSOURCES" msg_debug "[$(basename $0):$LINENO] generate tar khanat ressources: $KHANATRESSOURCES"
msg_debug "generate tar khanat data client: $KHANATDATACLIENT" msg_debug "[$(basename $0):$LINENO] generate tar khanat data client: $KHANATDATACLIENT"
msg_debug "generate tar ryzom ressources: $RYZOMRESSOURCES" msg_debug "[$(basename $0):$LINENO] generate tar ryzom ressources: $RYZOMRESSOURCES"
msg_debug "generate khanat image: $KHANATSERVER" msg_debug "[$(basename $0):$LINENO] generate khanat image: $KHANATSERVER"
msg_debug "launch khanat: $LAUNCHKHANAT" msg_debug "[$(basename $0):$LINENO] launch khanat: $LAUNCHKHANAT"
msg_debug "stop khanat: $STOPKHANAT" msg_debug "[$(basename $0):$LINENO] stop khanat: $STOPKHANAT"
if [[ ! -d ${OPENNEL_CODE_DIR} ]] if [[ ! -d ${OPENNEL_CODE_DIR} ]]
then then
msg_error "Missing directory opennel-code [${OPENNEL_CODE_DIR}]" msg_error "[$(basename $0):$LINENO] Missing directory opennel-code [${OPENNEL_CODE_DIR}]"
cat << EOF cat << EOF
You need clone repo khanat-opennel-code. You need clone repo khanat-opennel-code.
@ -337,10 +337,10 @@ fi
if [[ $KHANATRESSOURCES -ne 0 ]] if [[ $KHANATRESSOURCES -ne 0 ]]
then then
msg_info "CREATE TAR with KHANAT Ressources" msg_info "[$(basename $0):$LINENO] CREATE TAR with KHANAT Ressources"
if [[ ! -d ${ressourcedir} ]] if [[ ! -d ${ressourcedir} ]]
then then
msg_error "Missing khanat-ressources directory ($ressourcedir)" msg_error "[$(basename $0):$LINENO] Missing khanat-ressources directory ($ressourcedir)"
exit 2 exit 2
fi fi
(cd $ressourcedir; tar --exclude='.git' -czf ${extradir}/khanat-ressources.tar.gz .) || exit 2 (cd $ressourcedir; tar --exclude='.git' -czf ${extradir}/khanat-ressources.tar.gz .) || exit 2
@ -348,10 +348,10 @@ fi
if [[ $KHANATDATACLIENT -ne 0 ]] if [[ $KHANATDATACLIENT -ne 0 ]]
then then
msg_info "CREATE TAR with KHANAT DATA CLIENT" msg_info "[$(basename $0):$LINENO] CREATE TAR with KHANAT DATA CLIENT"
if [[ ! -d ${dataclientdir} ]] if [[ ! -d ${dataclientdir} ]]
then then
msg_error "Missing khanat-client-data directory ($dataclientdir)" msg_error "[$(basename $0):$LINENO] Missing khanat-client-data directory ($dataclientdir)"
exit 2 exit 2
fi fi
(cd $dataclientdir; tar --exclude='.git' -czf ${extradir}/khanat-client-data.tar.gz .) || exit 2 (cd $dataclientdir; tar --exclude='.git' -czf ${extradir}/khanat-client-data.tar.gz .) || exit 2
@ -359,10 +359,10 @@ fi
if [[ $RYZOMRESSOURCES -ne 0 ]] if [[ $RYZOMRESSOURCES -ne 0 ]]
then then
msg_info "CREATE TAR with RYZOM Ressources" msg_info "[$(basename $0):$LINENO] CREATE TAR with RYZOM Ressources"
if [[ ! -d ${ressourcedir} ]] if [[ ! -d ${ressourcedir} ]]
then then
msg_error "Missing khanat-ressources directory ($ressourcedir)" msg_error "[$(basename $0):$LINENO] Missing khanat-ressources directory ($ressourcedir)"
exit 2 exit 2
fi fi
cd ${OPENNEL_CODE_DIR}; tar czf ${extradir}/ryzom-ressources.tar.gz \ cd ${OPENNEL_CODE_DIR}; tar czf ${extradir}/ryzom-ressources.tar.gz \
@ -376,9 +376,9 @@ fi
if [[ $STOPKHANAT -ne 0 ]] if [[ $STOPKHANAT -ne 0 ]]
then then
msg_info "STOP SERVER KHANAT" msg_info "[$(basename $0):$LINENO] STOP SERVER KHANAT"
listcontainer="$(docker ps -qf 'status=running' -f 'ancestor='"${IMAGEKHANATSERVER}"'')" listcontainer="$(docker ps -qf 'status=running' -f 'ancestor='"${IMAGEKHANATSERVER}"'')"
msg_debug "CONTAINER KHANAT UP : ${listcontainer[@]}" msg_debug "[$(basename $0):$LINENO] CONTAINER KHANAT UP : ${listcontainer[@]}"
if [[ -n "$listcontainer" ]] if [[ -n "$listcontainer" ]]
then then
docker stop "$listcontainer" || exit 2 docker stop "$listcontainer" || exit 2
@ -387,9 +387,9 @@ fi
if [[ $CLEANCONTAINERKHANAT -ne 0 ]] if [[ $CLEANCONTAINERKHANAT -ne 0 ]]
then then
msg_info "CLEAN CONTAINER KHANAT" msg_info "[$(basename $0):$LINENO] CLEAN CONTAINER KHANAT"
listcontainer=( $(docker ps -qf 'status=exited' -f 'ancestor='"${IMAGEKHANATSERVER}"'') ) listcontainer=( $(docker ps -qf 'status=exited' -f 'ancestor='"${IMAGEKHANATSERVER}"'') )
msg_debug "CONTAINER KHANAT EXITED : ${listcontainer[@]}" msg_debug "[$(basename $0):$LINENO] CONTAINER KHANAT EXITED : ${listcontainer[@]}"
if [[ -n "${listcontainer[@]}" ]] if [[ -n "${listcontainer[@]}" ]]
then then
docker rm --force "${listcontainer[@]}" || exit 2 docker rm --force "${listcontainer[@]}" || exit 2
@ -398,10 +398,10 @@ fi
if [[ $CLEANIMAGENONE -ne 0 ]] if [[ $CLEANIMAGENONE -ne 0 ]]
then then
msg_info "CLEAN IMAGE DOCKER 'NONE'" msg_info "[$(basename $0):$LINENO] CLEAN IMAGE DOCKER 'NONE'"
listimages=( $(docker images | awk '{if ($1=="<none>")print $3}') ) listimages=( $(docker images --filter "dangling=true" --format "{{.ID}}") )
msg_debug "IMAGES NONE : ${listimages[@]}" msg_debug "[$(basename $0):$LINENO] IMAGES NONE : ${listimages[@]}"
if [[ -n "${listimages[@]}" ]] if [[ -n "${listimages[@]}" ]]
then then
docker rmi --force "${listimages[@]}" || exit 2 docker rmi --force "${listimages[@]}" || exit 2
@ -410,14 +410,14 @@ fi
if [[ $BASICSERVER -ne 0 ]] if [[ $BASICSERVER -ne 0 ]]
then then
msg_info "GENERATE DOCKER IMAGE BASIC SERVER" msg_info "[$(basename $0):$LINENO] GENERATE DOCKER IMAGE BASIC SERVER"
cd $rootdir; docker build . ${DOCKERBUILDOPT} -t ${IMAGEGENERICSERVER} \ cd $rootdir; docker build . ${DOCKERBUILDOPT} -t ${IMAGEGENERICSERVER} \
--file "${basedir}/Dockerfile" || exit 2 --file "${basedir}/Dockerfile" || exit 2
fi fi
if [[ $KHANATSERVER -ne 0 ]] if [[ $KHANATSERVER -ne 0 ]]
then then
msg_info "GENERATE DOCKER IMAGE KHANAT SERVER" msg_info "[$(basename $0):$LINENO] GENERATE DOCKER IMAGE KHANAT SERVER"
cat << EOF > $rootdir/todelete.sh cat << EOF > $rootdir/todelete.sh
#!/bin/bash #!/bin/bash
# Temporary file, use only to send some information on build docker # Temporary file, use only to send some information on build docker
@ -432,7 +432,7 @@ fi
if [[ $LAUNCHKHANAT -ne 0 ]] if [[ $LAUNCHKHANAT -ne 0 ]]
then then
msg_info "START KHANAT SERVER" msg_info "[$(basename $0):$LINENO] START KHANAT SERVER"
cd $rootdir; docker run -it --hostname=khanat \ cd $rootdir; docker run -it --hostname=khanat \
-v /etc/localtime:/etc/localtime:ro \ -v /etc/localtime:/etc/localtime:ro \
${IMAGEKHANATSERVER} /opt/serverimage_autostart.sh $METHODSTARTSERVER ${IMAGEKHANATSERVER} /opt/serverimage_autostart.sh $METHODSTARTSERVER
@ -440,4 +440,4 @@ then
fi fi
trap '' EXIT trap '' EXIT
msg_info "END" msg_info "[$(basename $0):$LINENO] END"

View file

@ -235,7 +235,7 @@ do
shift shift
;; ;;
*) *)
msg_error "options '$1' not recognize" msg_error "[$(basename $0):$LINENO] options '$1' not recognize"
usage usage
exit 1 exit 1
;; ;;
@ -244,7 +244,7 @@ done
function chrashed() function chrashed()
{ {
msg_error "BUILD FAILED (code:$?)" msg_error "[$(basename $0):$LINENO] BUILD FAILED (code:$?)"
exit 2 exit 2
} }
@ -252,15 +252,15 @@ trap chrashed EXIT
if [[ $SHOWIPKHANATSERVER -eq 0 ]] if [[ $SHOWIPKHANATSERVER -eq 0 ]]
then then
msg_info "START" msg_info "[$(basename $0):$LINENO] START"
fi fi
msg_debug "prg: $0" msg_debug "[$(basename $0):$LINENO] prg: $0"
docker -v 1>/dev/null docker -v 1>/dev/null
if [[ $? -ne 0 ]] if [[ $? -ne 0 ]]
then then
msg_error "docker not installed" msg_error "[$(basename $0):$LINENO] docker not installed"
exit 2 exit 2
fi fi
@ -270,28 +270,28 @@ case "$(uname -m)" in
i686) i686)
;; ;;
*) *)
msg_error "Unknown archi : $(uname -m)" msg_error "[$(basename $0):$LINENO] Unknown archi : $(uname -m)"
exit 2 exit 2
;; ;;
esac esac
if [[ $REMOVE -ne 0 ]] if [[ $REMOVE -ne 0 ]]
then then
msg_info "REMOVE DATA KHANAT : $ROOTDATAKHANAT" msg_info "[$(basename $0):$LINENO] REMOVE DATA KHANAT : $ROOTDATAKHANAT"
if [[ -n "$ROOTDATAKHANAT" ]] if [[ -n "$ROOTDATAKHANAT" ]]
then then
rm -rf ${ROOTDATAKHANAT}/* || exit 2 rm -rf ${ROOTDATAKHANAT}/* || exit 2
fi fi
fi fi
msg_debug "Create directory on host ($ROOTDATAKHANAT)" msg_debug "[$(basename $0):$LINENO] Create directory on host ($ROOTDATAKHANAT)"
mkdir -p $ROOTDATAKHANAT || exit 2 mkdir -p $ROOTDATAKHANAT || exit 2
chmod g+s $ROOTDATAKHANAT chmod g+s $ROOTDATAKHANAT
if [[ ($CONNECTSSHKHANAT -ne 0) || ($SHOWIPKHANATSERVER -ne 0) ]] if [[ ($CONNECTSSHKHANAT -ne 0) || ($SHOWIPKHANATSERVER -ne 0) ]]
then then
msg_debug "clean container" msg_debug "[$(basename $0):$LINENO] clean container"
listcontainer="$(docker ps -qf 'status=running' -f 'ancestor='"${IMAGEKHANATSERVER}"'')" listcontainer="$(docker ps -qf 'status=running' -f 'ancestor='"${IMAGEKHANATSERVER}"'')"
if [[ ${#listcontainer[@]} -eq 1 ]] if [[ ${#listcontainer[@]} -eq 1 ]]
then then
@ -310,13 +310,13 @@ if [[ $CONNECTSSHKHANAT -ne 0 ]]
then then
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no gameserver@$ipaddress ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no gameserver@$ipaddress
trap '' EXIT trap '' EXIT
msg_info "END SSH" msg_info "[$(basename $0):$LINENO] END SSH"
exit 0 exit 0
fi fi
if [[ $AUTODETEC -ne 0 ]] if [[ $AUTODETEC -ne 0 ]]
then then
msg_debug "Autodetect state" msg_debug "[$(basename $0):$LINENO] Autodetect state"
if [[ $(docker images -f "reference=$IMAGEGENERICSERVER" | wc -l) -lt 2 ]] if [[ $(docker images -f "reference=$IMAGEGENERICSERVER" | wc -l) -lt 2 ]]
then then
BASICSERVER=1 BASICSERVER=1
@ -345,22 +345,22 @@ fi
DIRBUILD="${rootdir}/${LOCALBUILDDIR}" DIRBUILD="${rootdir}/${LOCALBUILDDIR}"
msg_debug "calldir: $calldir" msg_debug "[$(basename $0):$LINENO] calldir: $calldir"
msg_debug "basedir: $basedir" msg_debug "[$(basename $0):$LINENO] basedir: $basedir"
msg_debug "rootdir: $rootdir" msg_debug "[$(basename $0):$LINENO] rootdir: $rootdir"
msg_debug "ressourcedir: $ressourcedir" msg_debug "[$(basename $0):$LINENO] ressourcedir: $ressourcedir"
msg_debug "generate basic image: $BASICSERVER" msg_debug "[$(basename $0):$LINENO] generate basic image: $BASICSERVER"
msg_debug "localization khanat-ressources : ${KHANAT_RESSOURCES_DIR}" msg_debug "[$(basename $0):$LINENO] localization khanat-ressources : ${KHANAT_RESSOURCES_DIR}"
msg_debug "localization khanat-client-data: ${KHANAT_CLIENT_DATA_DIR}" msg_debug "[$(basename $0):$LINENO] localization khanat-client-data: ${KHANAT_CLIENT_DATA_DIR}"
msg_debug "localization opennel-code-client : ${OPENNEL_CODE_DIR}" msg_debug "[$(basename $0):$LINENO] localization opennel-code-client : ${OPENNEL_CODE_DIR}"
msg_debug "generate khanat image: $KHANATSERVER" msg_debug "[$(basename $0):$LINENO] generate khanat image: $KHANATSERVER"
msg_debug "launch khanat: $LAUNCHKHANAT" msg_debug "[$(basename $0):$LINENO] launch khanat: $LAUNCHKHANAT"
msg_debug "stop khanat: $STOPKHANAT" msg_debug "stop khanat: $STOPKHANAT"
msg_info "check khanat-ressources" msg_info "[$(basename $0):$LINENO] check khanat-ressources"
if [[ ! -d ${KHANAT_RESSOURCES_DIR} ]] if [[ ! -d ${KHANAT_RESSOURCES_DIR} ]]
then then
msg_error "Missing directory khanat-ressources [${KHANAT_RESSOURCES_DIR}]" msg_error "[$(basename $0):$LINENO] Missing directory khanat-ressources [${KHANAT_RESSOURCES_DIR}]"
cat << EOF cat << EOF
You need clone repo khanat-ressource. You need clone repo khanat-ressource.
@ -372,10 +372,10 @@ EOF
fi fi
msg_info "check khanat-client-data" msg_info "[$(basename $0):$LINENO] check khanat-client-data"
if [[ ! -d ${KHANAT_CLIENT_DATA_DIR} ]] if [[ ! -d ${KHANAT_CLIENT_DATA_DIR} ]]
then then
msg_error "Missing directory khanat-client-data [${KHANAT_CLIENT_DATA_DIR}]" msg_error "[$(basename $0):$LINENO] Missing directory khanat-client-data [${KHANAT_CLIENT_DATA_DIR}]"
cat << EOF cat << EOF
You need clone repo khanat-client-data. You need clone repo khanat-client-data.
@ -388,7 +388,7 @@ fi
if [[ ! -d ${OPENNEL_CODE_DIR} ]] if [[ ! -d ${OPENNEL_CODE_DIR} ]]
then then
msg_error "Missing directory opennel-code [${OPENNEL_CODE_DIR}]" msg_error "[$(basename $0):$LINENO] Missing directory opennel-code [${OPENNEL_CODE_DIR}]"
cat << EOF cat << EOF
You need clone repo khanat-opennel-code. You need clone repo khanat-opennel-code.
@ -400,9 +400,9 @@ EOF
fi fi
if [[ $STOPKHANAT -ne 0 ]] if [[ $STOPKHANAT -ne 0 ]]
then then
msg_info "STOP SERVER KHANAT" msg_info "[$(basename $0):$LINENO] STOP SERVER KHANAT"
listcontainer="$(docker ps -qf 'status=running' -f 'ancestor='"${IMAGEKHANATSERVER}"'')" listcontainer="$(docker ps -qf 'status=running' -f 'ancestor='"${IMAGEKHANATSERVER}"'')"
msg_debug "CONTAINER KHANAT UP : ${listcontainer[@]}" msg_debug "[$(basename $0):$LINENO] CONTAINER KHANAT UP : ${listcontainer[@]}"
if [[ -n "$listcontainer" ]] if [[ -n "$listcontainer" ]]
then then
docker stop "$listcontainer" || exit 2 docker stop "$listcontainer" || exit 2
@ -411,9 +411,9 @@ fi
if [[ $CLEANCONTAINERKHANAT -ne 0 ]] if [[ $CLEANCONTAINERKHANAT -ne 0 ]]
then then
msg_info "CLEAN CONTAINER KHANAT" msg_info "[$(basename $0):$LINENO] CLEAN CONTAINER KHANAT"
listcontainer=( $(docker ps -qf 'status=exited' -f 'ancestor='"${IMAGEKHANATSERVER}"'') ) listcontainer=( $(docker ps -qf 'status=exited' -f 'ancestor='"${IMAGEKHANATSERVER}"'') )
msg_debug "CONTAINER KHANAT EXITED : ${listcontainer[@]}" msg_debug "[$(basename $0):$LINENO] CONTAINER KHANAT EXITED : ${listcontainer[@]}"
if [[ -n "${listcontainer[@]}" ]] if [[ -n "${listcontainer[@]}" ]]
then then
docker rm --force "${listcontainer[@]}" || exit 2 docker rm --force "${listcontainer[@]}" || exit 2
@ -422,10 +422,10 @@ fi
if [[ $CLEANIMAGENONE -ne 0 ]] if [[ $CLEANIMAGENONE -ne 0 ]]
then then
msg_info "CLEAN IMAGE DOCKER 'NONE'" msg_info "[$(basename $0):$LINENO] CLEAN IMAGE DOCKER 'NONE'"
listimages=( $(docker images | awk '{if ($1=="<none>")print $3}') ) listimages=( $(docker images --filter "dangling=true" --format "{{.ID}}") )
msg_debug "IMAGES NONE : ${listimages[@]}" msg_debug "[$(basename $0):$LINENO] IMAGES NONE : ${listimages[@]}"
if [[ -n "${listimages[@]}" ]] if [[ -n "${listimages[@]}" ]]
then then
docker rmi --force "${listimages[@]}" || exit 2 docker rmi --force "${listimages[@]}" || exit 2
@ -434,14 +434,14 @@ fi
if [[ $BASICSERVER -ne 0 ]] if [[ $BASICSERVER -ne 0 ]]
then then
msg_info "GENERATE DOCKER IMAGE BASIC SERVER" msg_info "[$(basename $0):$LINENO] GENERATE DOCKER IMAGE BASIC SERVER"
cd $rootdir; docker build . ${DOCKERBUILDOPT} -t ${IMAGEGENERICSERVER} \ cd $rootdir; docker build . ${DOCKERBUILDOPT} -t ${IMAGEGENERICSERVER} \
--file "${basedir}/Dockerfile" || exit 2 --file "${basedir}/Dockerfile" || exit 2
fi fi
if [[ $KHANATSERVER -ne 0 ]] if [[ $KHANATSERVER -ne 0 ]]
then then
msg_info "GENERATE DOCKER IMAGE KHANAT SERVER" msg_info "[$(basename $0):$LINENO] GENERATE DOCKER IMAGE KHANAT SERVER"
cat << EOF > $rootdir/${ENVIFILE} cat << EOF > $rootdir/${ENVIFILE}
#!/bin/bash #!/bin/bash
# Temporary file, use only to send some information on build docker # Temporary file, use only to send some information on build docker
@ -457,10 +457,10 @@ fi
if [[ $CONFIGUREKHANATSERVER -ne 0 ]] if [[ $CONFIGUREKHANATSERVER -ne 0 ]]
then then
msg_info "CONFIGURE KHANAT SERVER" msg_info "[$(basename $0):$LINENO] CONFIGURE KHANAT SERVER"
mkdir -p $DIRLOG || exit 2 mkdir -p $DIRLOG || exit 2
mkdir -p $DIRDATABASE || exit 2 mkdir -p $DIRDATABASE || exit 2
msg_debug "command : cd $rootdir; docker run -it --hostname=khanat \ msg_debug "[$(basename $0):$LINENO] command : cd $rootdir; docker run -it --hostname=khanat \
-v /etc/localtime:/etc/localtime:ro \ -v /etc/localtime:/etc/localtime:ro \
-v ${rootdir}/${LOCALBUILDDIR}/bin:/usr/local/bin:ro \ -v ${rootdir}/${LOCALBUILDDIR}/bin:/usr/local/bin:ro \
-v ${OPENNEL_CODE_DIR}/code/web/:/home/gameserver/ext/khanatweb:ro \ -v ${OPENNEL_CODE_DIR}/code/web/:/home/gameserver/ext/khanatweb:ro \
@ -488,8 +488,8 @@ fi
if [[ $UPDATEDATA -ne 0 ]] if [[ $UPDATEDATA -ne 0 ]]
then then
msg_info "UPDATE KHANAT SERVER" msg_info "[$(basename $0):$LINENO] UPDATE KHANAT SERVER"
msg_debug "command: cd $rootdir; docker run -it --hostname=khanat \ msg_debug "[$(basename $0):$LINENO] command: cd $rootdir; docker run -it --hostname=khanat \
-v /etc/localtime:/etc/localtime:ro \ -v /etc/localtime:/etc/localtime:ro \
-v ${rootdir}/${LOCALBUILDDIR}/bin:/usr/local/bin:ro \ -v ${rootdir}/${LOCALBUILDDIR}/bin:/usr/local/bin:ro \
-v ${OPENNEL_CODE_DIR}/code/web/:/home/gameserver/ext/khanatweb:ro \ -v ${OPENNEL_CODE_DIR}/code/web/:/home/gameserver/ext/khanatweb:ro \
@ -517,7 +517,7 @@ fi
if [[ $LAUNCHKHANAT -ne 0 ]] if [[ $LAUNCHKHANAT -ne 0 ]]
then then
msg_info "START KHANAT SERVER" msg_info "[$(basename $0):$LINENO] START KHANAT SERVER"
cd $rootdir; docker run -it --hostname=khanat \ cd $rootdir; docker run -it --hostname=khanat \
-u "$(id -u $USERNAME):$(id -g $USERNAME)" \ -u "$(id -u $USERNAME):$(id -g $USERNAME)" \
-v /etc/localtime:/etc/localtime:ro \ -v /etc/localtime:/etc/localtime:ro \
@ -534,4 +534,4 @@ then
fi fi
trap '' EXIT trap '' EXIT
msg_info "END" msg_info "[$(basename $0):$LINENO] END"

View file

@ -35,8 +35,8 @@ declare -i METHODSTARTSERVER=1
declare -i CLEANIMAGENONE=0 declare -i CLEANIMAGENONE=0
declare DOCKERBUILDOPT="" declare DOCKERBUILDOPT=""
declare IMAGEGENERICSERVER="server_generic_debian_jessie_x86_64" declare IMAGEGENERICSERVER="opennel/server_generic_debian_jessie_x86_64"
declare IMAGEKHANATSERVER="serverimage_khanat_debian_jessie_x86_64" declare IMAGEKHANATSERVER="opennel/serverimage_debian_jessie_x86_64"
declare LOCALBUILDDIR="build/opennel/builder_debian_jessie_x86_64" declare LOCALBUILDDIR="build/opennel/builder_debian_jessie_x86_64"
declare DIRCLIENT="Khanat_Linux64" declare DIRCLIENT="Khanat_Linux64"
declare PACKAGECLIENT="smokey_linux64" declare PACKAGECLIENT="smokey_linux64"
@ -211,10 +211,10 @@ trap chrashed EXIT
if [[ $SHOWIPKHANATSERVER -eq 0 ]] if [[ $SHOWIPKHANATSERVER -eq 0 ]]
then then
msg_info "START" msg_info "[$(basename $0):$LINENO] START"
fi fi
msg_debug "prg: $0" msg_debug "[$(basename $0):$LINENO] prg: $0"
extradir="${rootdir}/${DIROUTPUT}" extradir="${rootdir}/${DIROUTPUT}"
mkdir -p ${extradir} || exit 2 mkdir -p ${extradir} || exit 2
@ -223,7 +223,7 @@ mkdir -p ${extradir} || exit 2
docker -v 1>/dev/null docker -v 1>/dev/null
if [[ $? -ne 0 ]] if [[ $? -ne 0 ]]
then then
msg_error "docker not installed" msg_error "[$(basename $0):$LINENO] docker not installed"
exit 2 exit 2
fi fi
@ -233,7 +233,7 @@ case "$(uname -m)" in
i686) i686)
;; ;;
*) *)
msg_error "Unknown archi : $(uname -m)" msg_error "[$(basename $0):$LINENO] Unknown archi : $(uname -m)"
exit 2 exit 2
;; ;;
esac esac
@ -258,7 +258,7 @@ if [[ $CONNECTSSHKHANAT -ne 0 ]]
then then
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no gameserver@$ipaddress ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no gameserver@$ipaddress
trap '' EXIT trap '' EXIT
msg_info "END SSH" msg_info "[$(basename $0):$LINENO] END SSH"
exit 0 exit 0
fi fi
@ -297,10 +297,10 @@ then
sumsrc=1 sumsrc=1
sumdsr=2 sumdsr=2
fi fi
msg_debug "ryzomcore checksum src:$sumsrc dst:$sumdst" msg_debug "[$(basename $0):$LINENO] ryzomcore checksum src:$sumsrc dst:$sumdst"
if [[ "$sumsrc" != "$sumdst" ]] if [[ "$sumsrc" != "$sumdst" ]]
then then
msg_debug "copy ryzomcore" msg_debug "[$(basename $0):$LINENO] copy ryzomcore"
cp ${rootdir}/${LOCALBUILDDIR}/ryzomcore-0.12.0..tar.gz ${extradir}/ryzomcore.tar.gz || exit 2 cp ${rootdir}/${LOCALBUILDDIR}/ryzomcore-0.12.0..tar.gz ${extradir}/ryzomcore.tar.gz || exit 2
KHANATSERVER=1 KHANATSERVER=1
fi fi
@ -308,21 +308,21 @@ fi
DIRBUILD="${rootdir}/${LOCALBUILDDIR}" DIRBUILD="${rootdir}/${LOCALBUILDDIR}"
msg_debug "calldir: $calldir" msg_debug "[$(basename $0):$LINENO] calldir: $calldir"
msg_debug "basedir: $basedir" msg_debug "[$(basename $0):$LINENO] basedir: $basedir"
msg_debug "rootdir: $rootdir" msg_debug "[$(basename $0):$LINENO] rootdir: $rootdir"
msg_debug "ressourcedir: $ressourcedir" msg_debug "[$(basename $0):$LINENO] ressourcedir: $ressourcedir"
msg_debug "generate basic image: $BASICSERVER" msg_debug "[$(basename $0):$LINENO] generate basic image: $BASICSERVER"
msg_debug "generate tar khanat ressources: $KHANATRESSOURCES" msg_debug "[$(basename $0):$LINENO] generate tar khanat ressources: $KHANATRESSOURCES"
msg_debug "generate tar khanat data client: $KHANATDATACLIENT" msg_debug "[$(basename $0):$LINENO] generate tar khanat data client: $KHANATDATACLIENT"
msg_debug "generate tar ryzom ressources: $RYZOMRESSOURCES" msg_debug "[$(basename $0):$LINENO] generate tar ryzom ressources: $RYZOMRESSOURCES"
msg_debug "generate khanat image: $KHANATSERVER" msg_debug "[$(basename $0):$LINENO] generate khanat image: $KHANATSERVER"
msg_debug "launch khanat: $LAUNCHKHANAT" msg_debug "[$(basename $0):$LINENO] launch khanat: $LAUNCHKHANAT"
msg_debug "stop khanat: $STOPKHANAT" msg_debug "[$(basename $0):$LINENO] stop khanat: $STOPKHANAT"
if [[ ! -d ${OPENNEL_CODE_DIR} ]] if [[ ! -d ${OPENNEL_CODE_DIR} ]]
then then
msg_error "Missing directory opennel-code [${OPENNEL_CODE_DIR}]" msg_error "[$(basename $0):$LINENO] Missing directory opennel-code [${OPENNEL_CODE_DIR}]"
cat << EOF cat << EOF
You need clone repo khanat-opennel-code. You need clone repo khanat-opennel-code.
@ -335,10 +335,10 @@ fi
if [[ $KHANATRESSOURCES -ne 0 ]] if [[ $KHANATRESSOURCES -ne 0 ]]
then then
msg_info "CREATE TAR with KHANAT Ressources" msg_info "[$(basename $0):$LINENO] CREATE TAR with KHANAT Ressources"
if [[ ! -d ${ressourcedir} ]] if [[ ! -d ${ressourcedir} ]]
then then
msg_error "Missing khanat-ressources directory ($ressourcedir)" msg_error "[$(basename $0):$LINENO] Missing khanat-ressources directory ($ressourcedir)"
exit 2 exit 2
fi fi
(cd $ressourcedir; tar --exclude='.git' -czf ${extradir}/khanat-ressources.tar.gz .) || exit 2 (cd $ressourcedir; tar --exclude='.git' -czf ${extradir}/khanat-ressources.tar.gz .) || exit 2
@ -346,10 +346,10 @@ fi
if [[ $KHANATDATACLIENT -ne 0 ]] if [[ $KHANATDATACLIENT -ne 0 ]]
then then
msg_info "CREATE TAR with KHANAT DATA CLIENT" msg_info "[$(basename $0):$LINENO] CREATE TAR with KHANAT DATA CLIENT"
if [[ ! -d ${dataclientdir} ]] if [[ ! -d ${dataclientdir} ]]
then then
msg_error "Missing khanat-client-data directory ($dataclientdir)" msg_error "[$(basename $0):$LINENO] Missing khanat-client-data directory ($dataclientdir)"
exit 2 exit 2
fi fi
(cd $dataclientdir; tar --exclude='.git' -czf ${extradir}/khanat-client-data.tar.gz .) || exit 2 (cd $dataclientdir; tar --exclude='.git' -czf ${extradir}/khanat-client-data.tar.gz .) || exit 2
@ -357,10 +357,10 @@ fi
if [[ $RYZOMRESSOURCES -ne 0 ]] if [[ $RYZOMRESSOURCES -ne 0 ]]
then then
msg_info "CREATE TAR with RYZOM Ressources" msg_info "[$(basename $0):$LINENO] CREATE TAR with RYZOM Ressources"
if [[ ! -d ${ressourcedir} ]] if [[ ! -d ${ressourcedir} ]]
then then
msg_error "Missing khanat-ressources directory ($ressourcedir)" msg_error "[$(basename $0):$LINENO] Missing khanat-ressources directory ($ressourcedir)"
exit 2 exit 2
fi fi
cd ${OPENNEL_CODE_DIR}; tar czf ${extradir}/ryzom-ressources.tar.gz \ cd ${OPENNEL_CODE_DIR}; tar czf ${extradir}/ryzom-ressources.tar.gz \
@ -374,9 +374,9 @@ fi
if [[ $STOPKHANAT -ne 0 ]] if [[ $STOPKHANAT -ne 0 ]]
then then
msg_info "STOP SERVER KHANAT" msg_info "[$(basename $0):$LINENO] STOP SERVER KHANAT"
listcontainer="$(docker ps -qf 'status=running' -f 'ancestor='"${IMAGEKHANATSERVER}"'')" listcontainer="$(docker ps -qf 'status=running' -f 'ancestor='"${IMAGEKHANATSERVER}"'')"
msg_debug "CONTAINER KHANAT UP : ${listcontainer[@]}" msg_debug "[$(basename $0):$LINENO] CONTAINER KHANAT UP : ${listcontainer[@]}"
if [[ -n "$listcontainer" ]] if [[ -n "$listcontainer" ]]
then then
docker stop "$listcontainer" || exit 2 docker stop "$listcontainer" || exit 2
@ -385,9 +385,9 @@ fi
if [[ $CLEANCONTAINERKHANAT -ne 0 ]] if [[ $CLEANCONTAINERKHANAT -ne 0 ]]
then then
msg_info "CLEAN CONTAINER KHANAT" msg_info "[$(basename $0):$LINENO] CLEAN CONTAINER KHANAT"
listcontainer=( $(docker ps -qf 'status=exited' -f 'ancestor='"${IMAGEKHANATSERVER}"'') ) listcontainer=( $(docker ps -qf 'status=exited' -f 'ancestor='"${IMAGEKHANATSERVER}"'') )
msg_debug "CONTAINER KHANAT EXITED : ${listcontainer[@]}" msg_debug "[$(basename $0):$LINENO] CONTAINER KHANAT EXITED : ${listcontainer[@]}"
if [[ -n "${listcontainer[@]}" ]] if [[ -n "${listcontainer[@]}" ]]
then then
docker rm --force "${listcontainer[@]}" || exit 2 docker rm --force "${listcontainer[@]}" || exit 2
@ -396,10 +396,10 @@ fi
if [[ $CLEANIMAGENONE -ne 0 ]] if [[ $CLEANIMAGENONE -ne 0 ]]
then then
msg_info "CLEAN IMAGE DOCKER 'NONE'" msg_info "[$(basename $0):$LINENO] CLEAN IMAGE DOCKER 'NONE'"
listimages=( $(docker images | awk '{if ($1=="<none>")print $3}') ) listimages=( $(docker images --filter "dangling=true" --format "{{.ID}}") )
msg_debug "IMAGES NONE : ${listimages[@]}" msg_debug "[$(basename $0):$LINENO] IMAGES NONE : ${listimages[@]}"
if [[ -n "${listimages[@]}" ]] if [[ -n "${listimages[@]}" ]]
then then
docker rmi --force "${listimages[@]}" || exit 2 docker rmi --force "${listimages[@]}" || exit 2
@ -408,14 +408,14 @@ fi
if [[ $BASICSERVER -ne 0 ]] if [[ $BASICSERVER -ne 0 ]]
then then
msg_info "GENERATE DOCKER IMAGE BASIC SERVER" msg_info "[$(basename $0):$LINENO] GENERATE DOCKER IMAGE BASIC SERVER"
cd $rootdir; docker build . ${DOCKERBUILDOPT} -t ${IMAGEGENERICSERVER} \ cd $rootdir; docker build . ${DOCKERBUILDOPT} -t ${IMAGEGENERICSERVER} \
--file "${basedir}/Dockerfile" || exit 2 --file "${basedir}/Dockerfile" || exit 2
fi fi
if [[ $KHANATSERVER -ne 0 ]] if [[ $KHANATSERVER -ne 0 ]]
then then
msg_info "GENERATE DOCKER IMAGE KHANAT SERVER" msg_info "[$(basename $0):$LINENO] GENERATE DOCKER IMAGE KHANAT SERVER"
cat << EOF > $rootdir/todelete.sh cat << EOF > $rootdir/todelete.sh
#!/bin/bash #!/bin/bash
# Temporary file, use only to send some information on build docker # Temporary file, use only to send some information on build docker
@ -430,7 +430,7 @@ fi
if [[ $LAUNCHKHANAT -ne 0 ]] if [[ $LAUNCHKHANAT -ne 0 ]]
then then
msg_info "START KHANAT SERVER" msg_info "[$(basename $0):$LINENO] START KHANAT SERVER"
cd $rootdir; docker run -it --hostname=khanat \ cd $rootdir; docker run -it --hostname=khanat \
-v /etc/localtime:/etc/localtime:ro \ -v /etc/localtime:/etc/localtime:ro \
${IMAGEKHANATSERVER} /opt/serverimage_autostart.sh $METHODSTARTSERVER ${IMAGEKHANATSERVER} /opt/serverimage_autostart.sh $METHODSTARTSERVER
@ -438,4 +438,4 @@ then
fi fi
trap '' EXIT trap '' EXIT
msg_info "END" msg_info "[$(basename $0):$LINENO] END"