'mini update' more optional than before

This commit is contained in:
filux 2017-08-27 22:59:07 +02:00
parent 5a6c59f252
commit 056078909a
5 changed files with 33 additions and 17 deletions

View File

@ -28,7 +28,8 @@ if [ "$Compiler_version" != "" ] && [ "$Compiler_version" != "default" ]; then
set -x
if [ "$VersionAvByDefault" = "" ]; then
if [ "$distribution" = "Ubuntu" ]; then
if [ "$Compiler_name" = "gcc" ] || ( [ "$Compiler_name" = "clang" ] && [ "$codename" = "precise" ] ); then
#if [ "$Compiler_name" = "gcc" ] || ( [ "$Compiler_name" = "clang" ] && [ "$codename" = "precise" ] ); then
if [ "$Compiler_name" = "gcc" ] || [ "$Compiler_name" = "clang" ]; then
# https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test
sudo add-apt-repository --yes "deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu ${codename} main"
#sudo add-apt-repository --yes "deb-src http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu ${codename} main"

View File

@ -51,6 +51,7 @@ SHORT_GAME_NAME="megaglest"
PORTSTART=62001
NUM_OM_SERVERS=2
NUM_OA_SERVERS=1
SERVER_HARDW_MAX_LOAD_PERC="100"
# Log file location (beware, this can grow large)
# LOG_SERVER=/dev/null
@ -69,9 +70,11 @@ if [ "$(which lscpu 2>/dev/null)" != "" ]; then NUMCORES="$(lscpu -p | grep -cv
if [ "$NUMCORES" = "" ]; then NUMCORES=1; fi
echo "Notice: Detected processor with $NUMCORES cores." >&2
case $NUMCORES in
1) MAX_LOAD_MULT="0.65";; 2) MAX_LOAD_MULT="0.80";; 3) MAX_LOAD_MULT="0.90";; *) MAX_LOAD_MULT="0.95";;
1) MAX_LOAD_MULT="0.65";; 2) MAX_LOAD_MULT="0.75";; 3) MAX_LOAD_MULT="0.82";;
4) MAX_LOAD_MULT="0.88";; 5) MAX_LOAD_MULT="0.92";; *) MAX_LOAD_MULT="0.95";;
esac
MAX_LOAD="$(echo "$NUMCORES $MAX_LOAD_MULT" | awk '{print $1*$2}')"
if [ "$SERVER_HARDW_MAX_LOAD_PERC" -gt "100" ]; then SERVER_HARDW_MAX_LOAD_PERC=100; fi
MAX_LOAD="$(echo "$NUMCORES $MAX_LOAD_MULT $SERVER_HARDW_MAX_LOAD_PERC" | awk '{print $1*$2*($3/100)}')"
if [ "$1" != "" ] && [ "$(echo "$1" | grep '^[0-9]\+$')" != "" ]; then SERVERCOUNT="$1"
else SERVERCOUNT=0; fi
@ -145,7 +148,7 @@ fi
if [ "$SERVERTITLE" = "" ] && [ "$SERVERNAME" != "" ]; then SERVERTITLE="$SERVERNAME"; fi
if [ "$SERVERCOUNT" -gt "0" ]; then
echo "Info: Server '$SERVERTITLE' nr. $SERVERCOUNT ($2 ; $PORT)." >&2
sleep "$(($SERVERCOUNT * 3))"s
sleep "$(($SERVERCOUNT * 5))"s
fi
SER_PARAMETERS="--headless-server-mode=vps,exit"
#^ parameters without spaces and numbers inside
@ -215,6 +218,7 @@ while true; do
FIND_OUR_SER="$(echo "$FIND_ALL_SER" | grep '^\([^|]*|\)\{4\}'"$SERVER_GREP_IP"'|' \
| grep '^\([^|]*|\)\{11\}'"$PORT_FD"'[0-9]\{'"$PORT_NLD"'\}|')"
NUM_O_O_SER="$(echo "$FIND_OUR_SER" | wc -l)"
if [ "$NUM_O_O_SER" -eq "0" ]; then M_SERVER_STATUS=111; fi
if [ "$NUM_O_O_SER" != "" ] && [ "$NUM_O_O_SER" -lt "$NUM_OM_SERVERS" ]; then :
elif [ "$SERVERCOUNT" -le "$NUM_OS_SMOD" ]; then
NUM_O_FREE_SER="$(echo "$FIND_OUR_SER" | grep '^\([^|]*|\)\{10\}0|' -c)"
@ -249,8 +253,8 @@ while true; do
echo "... dev_version update:" >&2
"$GAMEDIR/../${SHORT_GAME_NAME}-dev_version-update.sh" "$GAMEDIR"; sleep 1s
echo "#" > "$GAMEDIR/${SHORT_GAME_NAME}-dev_version-update-done.log"; sleep 1s
"$GAMEDIR/$SERVER_SCRIPT" "$@" &
break
#"$GAMEDIR/$SERVER_SCRIPT" "$@" &
#break
else
rm -f "$GAMEDIR/${SHORT_GAME_NAME}-dev_version-update-done.log"
fi
@ -335,10 +339,11 @@ while true; do
exit 1
fi
sleep 5s
if [ "$SERVERCOUNT" -eq "1" ] && [ "$SERVER_GREP_IP" != "" ] && \
[ -e "$GAMEDIR/${SHORT_GAME_NAME}-mini-update.sh" ]; then
if [ "$SERVERCOUNT" -eq "1" ] && [ -e "$GAMEDIR/${SHORT_GAME_NAME}-mini-update.sh" ] && \
[ "$SERVER_GREP_IP" != "" ] && [ "$MINI_UPDATE_USED" = "" ]; then
echo "... attempt to perform mini update, which may solve tiny problems:" >&2
"$GAMEDIR/${SHORT_GAME_NAME}-mini-update.sh"; sleep 1s
MINI_UPDATE_USED="yes"
fi
else
echo 'Notice: Server was restarted by script.' >> "$LOG_SERVER"

View File

@ -74,6 +74,9 @@ Setup.Package
if MojoSetup.platform.exists(MojoSetup.destination .. '/lib/') then
os.execute('rm -rf ' .. MojoSetup.destination .. '/lib/')
end
if MojoSetup.platform.exists(MojoSetup.destination .. '/.lib_bak/') then
os.execute('rm -rf ' .. MojoSetup.destination .. '/.lib_bak/')
end
if MojoSetup.platform.exists(MojoSetup.destination) then
os.execute('rm -rf ' .. MojoSetup.destination)
end

View File

@ -1,6 +1,6 @@
#!/bin/sh
# 2015 Written by filux <heross(@@)o2.pl>
# Copyright (c) 2015 under GNU GPL v3.0+
# Copyright (c) 2015-2017 under GNU GPL v3.0+
# ----------------------------------------------------------------------------
LANG=C
@ -13,7 +13,7 @@ mkdir -p lib-x86; mkdir -p lib-x86_64
if [ "$?" -eq "0" ]; then
echo '#!/bin/sh
# 2015 Written by filux <heross(@@)o2.pl>
# Copyright (c) 2015 under GNU GPL v3.0+
# Copyright (c) 2015-2017 under GNU GPL v3.0+
# ----------------------------------------------------------------------------
LANG=C
@ -36,6 +36,7 @@ if [ ! -e "$MU_PACKAGE_NAME" ]; then
echo "Extracting $MU_PACKAGE_NAME ..."; sleep 2s
tar xzf "$MU_PACKAGE_NAME" -C "./"; sleep 1s
fi
if [ ! -e "$MU_PACKAGE_NAME" ]; then echo "The $MU_PACKAGE_NAME was not found ..."; fi
if [ -e "megaglest-mini_update/megaglest-mini-update.sh" ]; then
cp -f --no-dereference --preserve=all "megaglest-mini_update/megaglest-mini-update.sh" ./; sleep 0.5s
./megaglest-mini-update.sh; sleep 0.5s
@ -46,7 +47,8 @@ else
if [ -d "megaglest-mini_update" ]; then
if [ -d "megaglest-mini_update/$LibDir" ]; then
mv "megaglest-mini_update/$LibDir" "megaglest-mini_update/lib"; sleep 0.25s
rm -rf "lib" "lib-x86_64" "lib-x86" "megaglest-mini_update/lib-x86_64" "megaglest-mini_update/lib-x86"; sleep 0.25s
rm -rf "lib" ".lib_bak" "lib-x86_64" "lib-x86" "megaglest-mini_update/lib-x86_64" "megaglest-mini_update/lib-x86"
sleep 0.25s
fi
mv -f "megaglest-mini_update/"* "./"; sleep 0.5s; rm -rf "megaglest-mini_update"
echo "Mini update finished."

View File

@ -1,7 +1,7 @@
#!/bin/sh
# 2011 Written by Mark Vejvoda <mark_vejvoda@hotmail.com>
# 2014 Rewritten by filux <heross(@@)o2.pl>
# Copyright (c) 2011-2016 under GNU GPL v3.0+
# Copyright (c) 2011-2017 under GNU GPL v3.0+
# ----------------------------------------------------------------------------
# If you want to have core files generated (for debugging purposes):
# ulimit -c unlimited
@ -22,7 +22,9 @@ SHORT_GAME_NAME="megaglest"
LONG_GAME_NAME="MegaGlest"
# -------
LIBDIR="lib"; ExitStatus=0; LibsWarnings=""; IgnoredLibs=""; FirstLnError=""
LibDir_wP="$GAMEDIR/$LIBDIR"; if [ ! -d "$LibDir_wP" ]; then mkdir "$LibDir_wP"; fi
LibDir_wP="$GAMEDIR/$LIBDIR"; LIBDIR_B=".${LIBDIR}_bak"; LibDirB_wP="$GAMEDIR/$LIBDIR_B"
if [ ! -d "$LibDir_wP" ]; then mkdir "$LibDir_wP"; fi
if [ ! -d "$LibDirB_wP" ]; then mkdir "$LibDirB_wP"; fi
if [ "$1" = "--tool-editor" ] || [ "$1" = "--tool-g3dviewer" ] || [ "$1" = "--tool-buginfo" ];
then OperatingMode="$1"; else OperatingMode="--game"; fi
BeginTime="$(date +"%s")"
@ -116,7 +118,7 @@ if [ "$OperatingMode" != "--tool-buginfo" ]; then
fi
fi
else
if [ -e "$SO_LINKED_LIB" ]; then rm -f "$SO_LINKED_LIB"; fi
if [ -e "$SO_LINKED_LIB" ]; then mv -f "$SO_LINKED_LIB" "$LibDirB_wP"; fi
if [ "$(echo "$c_required_libs" | grep "${SO_LIB_PATTERN}[ \t]*=>[ \t]*not found")" != "" ] && [ "$EmbLibExist" = "no" ]; then
#rare exception
LibsWarnings="$LibsWarnings
@ -309,14 +311,14 @@ if [ "$OperatingMode" != "--tool-buginfo" ]; then
IfRealLibExist() {
RealEmbLib="$LibDir_wP/$1"
if [ ! -L "$RealEmbLib" ] && [ -e "$RealEmbLib" ]; then
if [ "$2" = "remove" ]; then rm -f "$RealEmbLib"; else return 0; fi
if [ "$2" = "remove" ]; then mv -f "$RealEmbLib" "$LibDirB_wP"; else return 0; fi
else return 1; fi
}
# exceptions, keep them in sync with listed libraries on 'libs_list'
if [ "$(echo "$OS_INFO" | grep 'Debian\|Ubuntu\|LinuxMint')" = "" ]; then IfRealLibExist "libSDL2-2.0.so.0" "remove"; fi
if [ "$OperatingMode" = "--game" ]; then
if [ "$(IfRealLibExist "libvlc.so.5"; echo "$?")" -ne "0" ] && [ "$(IfRealLibExist "libvlccore.so.7"; echo "$?")" -ne "0" ] && \
[ -d "$LibDir_wP/vlc" ]; then rm -rf "$LibDir_wP/vlc"; fi
[ -d "$LibDir_wP/vlc" ]; then mv -f "$LibDir_wP/vlc" "$LibDirB_wP"; fi
else
if [ "$(IfRealLibExist "libwx_gtk2u_core-3.0.so.0"; echo "$?")" -ne "0" ] || \
[ "$(IfRealLibExist "libwx_baseu-3.0.so.0"; echo "$?")" -ne "0" ] || \
@ -329,6 +331,7 @@ if [ "$OperatingMode" != "--tool-buginfo" ]; then
lw_log="$LibDir_wP/.last_w_check.log"; li_log="$LibDir_wP/.last_i_check.log"
pw_log="$LibDir_wP/.previous_w_check.log"; pi_log="$LibDir_wP/.previous_i_check.log"
pw_err="$LibDir_wP/.previous_err_d_check.log"
LibsWarningsLogs() {
if [ "$1" = "create_new" ]; then
echo "#" > "$lw_log"; echo "#" > "$li_log"
@ -349,6 +352,8 @@ if [ "$OperatingMode" != "--tool-buginfo" ]; then
fi
}
checkLibsStatus2() {
if [ -f "$pw_err" ] && [ -d "$LibDirB_wP" ]; then rm -f "$pw_err"
mv -f "$LibDirB_wP"/* "$LibDir_wP"; sleep 1s; fi
checkLibsStatus "$libs_list"; LibsWarningsLogs "save_new"; sleep 1s; LibsWarningsLogs "rotate"
}
if [ "$OperatingMode" = "--game" ] && [ "$(LibsWarningsLogs "check_current"; echo "$?")" -eq "0" ]; then
@ -387,7 +392,7 @@ if [ "$ExitStatus" -ne "0" ] || [ "$OperatingMode" = "--tool-editor" ] || [ "$Op
if [ "$OperatingMode" = "--game" ]; then ShowLibsTime=35; else ShowLibsTime=45; fi
if [ "$DiffTime" -le "$ShowLibsTime" ] && [ -e "$GAMEDIR/$BinaryToCheck" ] && [ -x "$GAMEDIR/$BinaryToCheck" ]; then
if [ "$OperatingMode" = "--game" ] || [ "$OperatingMode" = "--tool-buginfo" ]; then
LibsWarnings="
echo "#" > "$pw_err"; LibsWarnings="
|| $LONG_GAME_NAME requires some libraries to be present on this operating system.
|| Missing libraries (if any) will be listed next, along with full names
|| and default versions. Use the package manager provided by your Linux