improved version of basic linux's scripts
This commit is contained in:
parent
4df898cd70
commit
1f09c212e7
|
@ -1,305 +1,300 @@
|
|||
#!/bin/sh
|
||||
|
||||
# 2011 Written by Mark Vejvoda <mark_vejvoda@hotmail.com>
|
||||
# 2014 Rewritten by filux <heross(@@)o2.pl>
|
||||
# Copyright (c) 2011-2015 under GNU GPL v3.0+
|
||||
# ----------------------------------------------------------------------------
|
||||
# If you want to have core files generated (for debugging purposes):
|
||||
#ulimit -c unlimited
|
||||
# ulimit -c unlimited
|
||||
LANG=C
|
||||
|
||||
findMissingSO () {
|
||||
SCRIPTLOCATION="$(readlink -f "$0")"
|
||||
GAMEDIR="$(dirname "$SCRIPTLOCATION")"
|
||||
ARCHITECTURE="$(uname -m | tr '[A-Z]' '[a-z]')"
|
||||
BugReport1="'https://github.com/MegaGlest/megaglest-source/issues'"
|
||||
BugReport2="'https://forum.megaglest.org/index.php?board=23.0'"
|
||||
LIBDIR="lib"; ExitStatus=0; LibsWarnings=""; IgnoredLibs=""
|
||||
if [ ! -d "$GAMEDIR/$LIBDIR" ]; then mkdir "$GAMEDIR/$LIBDIR"; fi
|
||||
if [ "$1" = "--tool-editor" ]; then OperatingMode="--tool-editor"
|
||||
elif [ "$1" = "--tool-g3dviewer" ]; then OperatingMode="--tool-g3dviewer"
|
||||
elif [ "$1" = "--tool-buginfo" ]; then OperatingMode="--tool-buginfo"
|
||||
else OperatingMode="--game"; fi
|
||||
BeginTime="$(date +"%s")"
|
||||
if [ "$(which lsb_release 2>/dev/null)" != "" ]; then
|
||||
OS_INFO_P="$(which lsb_release) -d"
|
||||
OS_INFO="$($OS_INFO_P | awk -F ':[ \t]*' '{print $2}')"
|
||||
fi
|
||||
|
||||
LDCONFIG="$1"
|
||||
SO_LINKEDLIBNAME="$2"
|
||||
SO_LIBLOOKUP1="$3"
|
||||
SO_LIBLOOKUP2="$4"
|
||||
|
||||
hasSO=`$LDCONFIG -p | grep -m 1 "$SO_LIBLOOKUP1" | cut "-d>" -f2 | cut "-d " -f2`
|
||||
if [ -n "$hasSO" ]; then
|
||||
echo 'default library ['"$SO_LINKEDLIBNAME"'] was found in ['"$hasSO"']' >&2
|
||||
else
|
||||
echo 'default library ['"$SO_LINKEDLIBNAME"'] is missing, attempting to find and link to a newer version if available...' >&2
|
||||
hasSO=`$LDCONFIG -p | grep -m 1 "$SO_LIBLOOKUP2" | cut "-d>" -f2 | cut "-d " -f2`
|
||||
if [ -n "$hasSO" ]; then
|
||||
echo 'new library link ['"$hasSO"'] pointed to from ['"$SO_LINKEDLIBNAME"']' >&2
|
||||
ln -f -s $hasSO $SO_LINKEDLIBNAME
|
||||
fi
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# Library directory
|
||||
LIBDIR='lib'
|
||||
|
||||
# As a first step to determine the absolute path of the directory the game
|
||||
# resides in, dereference symlinks to this script and convert relative to
|
||||
# absolute paths along the way.
|
||||
MYLOCATION="`readlink -f $0`"
|
||||
|
||||
# The game directory is the directory the script resides in
|
||||
GAMEDIR="`dirname $MYLOCATION`"
|
||||
|
||||
# Change to the game dir, and go!
|
||||
cd $GAMEDIR
|
||||
echo 'gamedir ['"$GAMEDIR"']' >&2
|
||||
|
||||
# export game library directory
|
||||
test -n "${LIBDIR}" && export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GAMEDIR}/${LIBDIR}"
|
||||
|
||||
# ensure ldconfig is found (was an issue on OpenSuSE 11.2)
|
||||
echo 'Looking for LDCONFIG ['"$LDCONFIG"']...' >&2
|
||||
|
||||
if [ "$LDCONFIG"'_' = '_' ]; then # 'LDCONFIG' environment variable, if set, overrides the following detection
|
||||
echo 'LDCONFIG environment variable is not set...' >&2
|
||||
if [ `which ldconfig 2>/dev/null` ]; then
|
||||
LDCONFIG=`which ldconfig 2>/dev/null`
|
||||
echo 'Found LDCONFIG using which ['"$LDCONFIG"']...' >&2
|
||||
else
|
||||
if [ -x /sbin/ldconfig ]; then
|
||||
LDCONFIG=/sbin/ldconfig
|
||||
echo 'Found LDCONFIG in /sbin ['"$LDCONFIG"']...' >&2
|
||||
# optionally add more custom locations using 'elseif' here
|
||||
if [ "$OperatingMode" != "--tool-buginfo" ]; then
|
||||
if [ "$LDCONFIG" = "" ]; then
|
||||
if [ "$(which ldconfig 2>/dev/null)" != "" ]; then
|
||||
LDCONFIG="$(which ldconfig 2>/dev/null)"; LDconfigType=1
|
||||
elif [ -x "/sbin/ldconfig" ]; then
|
||||
LDCONFIG="/sbin/ldconfig"; LDconfigType=2
|
||||
else
|
||||
echo 'ERROR: Could not find the "ldconfig" command.' >&2
|
||||
echo 'Please re-run using: "LDCONFIG=/path/to/ldconfig '"$0" >&2
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo 'ERROR: Could not find the "ldconfig" command.' >&2
|
||||
echo 'Please re-run using: "LDCONFIG=/path/to/ldconfig '"$0" >&2
|
||||
exit 1
|
||||
LDconfigType=9
|
||||
fi
|
||||
LibsWarnings="$LibsWarnings
|
||||
|| If for some reason you see an error related with library, then you should try install this library
|
||||
|| in your linux. Hints with full names and with default versions of just detected missing libraries you
|
||||
|| see below.
|
||||
|| You can also perform mini update by launch 'megaglest-mini-update.sh' script, which may solve tiny problems.
|
||||
|| If it is other problem or after your tries it still doesn't work then please report a bug
|
||||
|| here: $BugReport1
|
||||
|| or here: $BugReport2."
|
||||
LibsWarnings="$LibsWarnings
|
||||
||
|
||||
|| Found LDCONFIG variable [$LDconfigType][$LDCONFIG]...
|
||||
|| OS info. [$OS_INFO], Arch.[$ARCHITECTURE], Dir.[$GAMEDIR]"
|
||||
|
||||
if [ "$ARCHITECTURE" = "x86_64" ]; then GrepPattern="x86[_-]64"
|
||||
else GrepPattern="$ARCHITECTURE"; fi
|
||||
LDCONFIG_P="$($LDCONFIG -p)"; ArchSortLibs="no"
|
||||
LDCONFIG_P_ARCH="$(echo "$LDCONFIG_P" | grep "$GrepPattern")"
|
||||
if [ "$LDCONFIG_P_ARCH" != "" ]; then
|
||||
LDCONFIG_P_R_ARCH="$(echo "$LDCONFIG_P" | grep -v "$GrepPattern")"
|
||||
ArchSortLibs="yes"
|
||||
fi
|
||||
if [ "$OperatingMode" = "--game" ]; then
|
||||
ldd_target="$GAMEDIR/megaglest"
|
||||
elif [ "$OperatingMode" = "--tool-editor" ]; then
|
||||
ldd_target="$GAMEDIR/megaglest_editor"
|
||||
elif [ "$OperatingMode" = "--tool-g3dviewer" ]; then
|
||||
ldd_target="$GAMEDIR/megaglest_g3dviewer"
|
||||
fi
|
||||
c_required_libs="$(ldd "$ldd_target")"
|
||||
|
||||
hasSOlib() {
|
||||
if [ "$2" = "myarch" ]; then
|
||||
if [ "$ArchSortLibs" = "yes" ]; then OS_libs_list="$LDCONFIG_P_ARCH"; else OS_libs_list="$LDCONFIG_P"; fi
|
||||
else
|
||||
if [ "$ArchSortLibs" = "yes" ]; then OS_libs_list="$LDCONFIG_P_R_ARCH"; else OS_libs_list=""; fi
|
||||
fi
|
||||
if [ "$OS_libs_list" != "" ]; then
|
||||
echo "$OS_libs_list" | grep -m 1 "[^_-]$1" | cut "-d>" -f2 | cut "-d " -f2
|
||||
fi
|
||||
}
|
||||
findMissingSO() {
|
||||
SO_WANTED_LIB="$1"; SO_WANTED_LIB2="$2"; SO_LIB_PATTERN="$3"
|
||||
SO_LINKED_LIB="$GAMEDIR/$LIBDIR/$SO_WANTED_LIB2"
|
||||
hasSO="$(hasSOlib "$SO_LIB_PATTERN" "myarch")"; CommonPart="no"
|
||||
if [ "$hasSO" != "" ]; then
|
||||
CommonPart="yes"
|
||||
elif [ "$SO_WANTED_LIB" = "$SO_LIB_PATTERN" ] && [ ! -h "$SO_LINKED_LIB" ] && [ -e "$SO_LINKED_LIB" ]; then
|
||||
LibsWarnings="$LibsWarnings
|
||||
||- default library [$SO_WANTED_LIB2] is missing in your OS, using embedded library."
|
||||
return 0
|
||||
else
|
||||
hasSO="$(hasSOlib "$SO_LIB_PATTERN")"
|
||||
if [ "$ArchSortLibs" = "yes" ] && [ "$hasSO" != "" ]; then
|
||||
CommonPart="yes"
|
||||
else
|
||||
if [ "$SO_WANTED_LIB" = "$SO_LIB_PATTERN" ]; then
|
||||
LibsWarnings="$LibsWarnings
|
||||
||- default library [$SO_WANTED_LIB2] is missing in your OS, attempting to find and link to different version if is available..."
|
||||
fi
|
||||
if [ "$4" != "no" ]; then
|
||||
LibsWarnings="$LibsWarnings
|
||||
|| > not found !"
|
||||
fi
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
if [ "$CommonPart" = "yes" ]; then
|
||||
if [ "$SO_WANTED_LIB" != "$SO_LIB_PATTERN" ]; then
|
||||
LibsWarnings="$LibsWarnings
|
||||
|| new library link [.../$LIBDIR/$SO_WANTED_LIB2] pointed to [$hasSO]."
|
||||
ln -f -s $hasSO $SO_LINKED_LIB
|
||||
else
|
||||
if [ -e "$SO_LINKED_LIB" ]; then rm -f $SO_LINKED_LIB; fi
|
||||
if [ "$(echo "$c_required_libs" | grep "$SO_LIB_PATTERN[ \t]*=>[ \t]*not found")" != "" ]; then
|
||||
#rare exception
|
||||
LibsWarnings="$LibsWarnings
|
||||
||- default library: [$SO_WANTED_LIB2] is missing in your OS, attempting to find and link to different version if is available...
|
||||
|| > not found !"
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
checkLibsStatus() {
|
||||
if [ "$1" != "" ]; then
|
||||
list_of_libs="$(echo "$1" | sed -e 's|\([^\]\)\.|\1\\.|g' -e 's|\[num\]|[0-9]\\+|g')"
|
||||
for var in $list_of_libs; do
|
||||
patterns="$(echo "$var" | sed -e 's|^ */||' -e 's|/| |g' -e 's/| /|/')"
|
||||
patterns_num="$(echo "$patterns" | wc -w)"
|
||||
wanted_lib="$(echo "$patterns" | awk '{print $1}')"; i=2
|
||||
wanted_lib2="$(echo "$wanted_lib" | sed 's/\\//g')";
|
||||
last_pattern="$(echo "$patterns" | awk '{print $(NF-1)}')"
|
||||
if [ "$(echo "$c_required_libs" | grep "[^_-]$last_pattern")" != "" ]; then
|
||||
for var2 in $patterns; do
|
||||
if [ "$var2" = "|" ]; then break; fi
|
||||
lib_pattern="$(echo "$var" | awk -F '/' -v ii="$i" '{print $ii}')"
|
||||
if [ "$i" -lt "$patterns_num" ]; then end_w="no"; else end_w="yes"; fi
|
||||
findMissingSO "$wanted_lib" "$wanted_lib2" "$lib_pattern" "$end_w"
|
||||
if [ "$?" -eq "0" ]; then break; else i=$((i + 1)); fi
|
||||
done
|
||||
else
|
||||
IgnoredLibs="$IgnoredLibs $wanted_lib2"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
# Each line /.../.../|/ .
|
||||
# First entry libs_list="...\n...\n..." ,
|
||||
# each next libs_list="$libs_list\n...\n..." .
|
||||
# First word should be original name, in any other you can use [0-9] what mean "any digit",
|
||||
# or [num] what mean "any number with one or more digits".
|
||||
# Last word should have length at least 6 chars, but use longer if string is too much common.
|
||||
|
||||
# ignored: linux-vdso.so*, linux-gate.so*, ld-linux-*.so*
|
||||
libs_list="/libSDL-1.2.so.0/libSDL-1.[num].so/libSDL-[0-9].[num].so/libSDL-/|/
|
||||
/libpthread.so.0/libpthread.so/libpthread/|/
|
||||
/libGLU.so.1/libGLU.so/|/
|
||||
/libGL.so.1/libGL.so/|/
|
||||
/libSM.so.6/libSM.so/|/
|
||||
/libICE.so.6/libICE.so/|/
|
||||
/libX11.so.6/libX11.so/|/
|
||||
/libXext.so.6/libXext.so/libXext/|/
|
||||
/libidn.so.11/libidn.so/|/
|
||||
/liblber-2.4.so.2/liblber-2.[num].so/liblber-[0-9].[num].so/liblber-/liblber/|/
|
||||
/libldap_r-2.4.so.2/libldap_r-2.[num].so/libldap_r-[0-9].[num].so/libldap_r-/libldap_r/|/
|
||||
/librt.so.1/librt.so/|/
|
||||
/libgssapi_krb5.so.2/libgssapi_krb[0-9].so/libgssapi_krb[num].so/libgssapi_krb/|/
|
||||
/libz.so.1/libz.so/|/
|
||||
/libgnutls.so.26/libgnutls.so.2[0-9]/libgnutls.so/libgnutls/|/
|
||||
/libgcrypt.so.11/libgcrypt.so.1[0-9]/libgcrypt.so/libgcrypt/|/
|
||||
/libdl.so.2/libdl.so/|/
|
||||
/libfontconfig.so.1/libfontconfig.so/libfontconfig/|/
|
||||
/libfreetype.so.6/libfreetype.so/libfreetype/|/
|
||||
/libglib-2.0.so.0/libglib-2.[num].so/libglib-[0-9].[num].so/libglib-[0-9]/libglib-/|/
|
||||
/libstdc++.so.6/libstdc++.so/libstdc++/|/
|
||||
/libm.so.6/libm.so/|/
|
||||
/libgcc_s.so.1/libgcc_s.so/libgcc_s/|/
|
||||
/libc.so.6/libc.so/|/
|
||||
/libpulse-simple.so.0/libpulse-simple.so/libpulse-simple/|/
|
||||
/libpulse.so.0/libpulse.so/|/
|
||||
/libdirectfb-1.2.so.0/libdirectfb-1.[num].so/libdirectfb-[0-9].[num].so/libdirectfb-/libdirectfb/|/
|
||||
/libfusion-1.2.so.0/libfusion-1.[num].so/libfusion-[0-9].[num].so/libfusion-/libfusion/|/
|
||||
/libdirect-1.2.so.0/libdirect-1.[num].so/libdirect-[0-9].[num].so/libdirect-/|/
|
||||
/libXxf86vm.so.1/libXxf86vm.so/libXxf86vm/|/
|
||||
/libXdamage.so.1/libXdamage.so/libXdamage/|/
|
||||
/libXfixes.so.3/libXfixes.so/libXfixes/|/
|
||||
/libdrm.so.2/libdrm.so/|/
|
||||
/libuuid.so.1/libuuid.so/libuuid/|/
|
||||
/libxcb.so.1/libxcb.so/|/
|
||||
/libvorbis.so.0/libvorbis.so/|/
|
||||
/libogg.so.0/libogg.so/libogg/|/
|
||||
/libresolv.so.2/libresolv.so/libresolv/|/
|
||||
/libsasl2.so.2/libsasl[0-9].so/libsasl/|/
|
||||
/libkrb5.so.3/libkrb[0-9].so.[num]/libkrb[num].so/|/
|
||||
/libk5crypto.so.3/libk[0-9]crypto.so/libk[num]crypto/|/
|
||||
/libcom_err.so.2/libcom_err.so/libcom_err/|/
|
||||
/libkrb5support.so.0/libkrb[0-9]support.so/libkrb[num]support/|/
|
||||
/libkeyutils.so.1/libkeyutils.so/libkeyutils/|/
|
||||
/libtasn1.so.3/libtasn1.so/libtasn[num].so/libtasn[0-9]/libtasn/|/
|
||||
/libgpg-error.so.0/libgpg-error.so/libgpg-error/|/
|
||||
/libexpat.so.1/libexpat.so/libexpat/|/
|
||||
/libpcre.so.3/libpcre.so/|/
|
||||
/libXtst.so.6/libXtst.so/libXtst/|/
|
||||
/libXau.so.6/libXau.so/|/
|
||||
/libXdmcp.so.6/libXdmcp.so/libXdmcp/|/
|
||||
/libwrap.so.0/libwrap.so/libwrap/|/
|
||||
/libsndfile.so.1/libsndfile.so/libsndfile/|/
|
||||
/libdbus-1.so.3/libdbus-[0-9].so/libdbus-[num]/libdbus-/|/
|
||||
/libXi.so.6/libXi.so/|/
|
||||
/libnsl.so.1/libnsl.so/|/
|
||||
/libFLAC.so.8/libFLAC.so/|/
|
||||
/libvorbisenc.so.2/libvorbisenc.so/libvorbisenc/|/
|
||||
/librtmp.so.0/librtmp.so/librtmp/|/
|
||||
/libjpeg.so.62/libjpeg.so.6[0-9]/libjpeg.so/libjpeg/|/
|
||||
/libcurl.so.4/libcurl.so/libcurl/|/
|
||||
/libxerces-c-3.1.so/libxerces-c-3.[num].so/libxerces-c-[0-9].[num].so/libxerces-c-[0-9]/libxerces-c-/|/
|
||||
/libicudata.so.40/libicudata.so.4[0-9]/libicudata.so/libicudata/|/
|
||||
/libicuuc.so.40/libicuuc.so.4[0-9]/libicuuc.so/libicuuc/|/
|
||||
/libGLEW.so.1.5/libGLEW.so.1.[num]/libGLEW.so/libGLEW/|/
|
||||
/liblua5.1.so.0/liblua5.[num].so/liblua[0-9].[num].so/liblua[0-9]/liblua/|/
|
||||
/libftgl.so.2/libftgl.so/libftgl/|/
|
||||
/libircclient.so.1/libircclient.so/libircclient/|/
|
||||
/libminiupnpc.so.5/libminiupnpc.so/libminiupnpc/|/
|
||||
/libxml2.so.2/libxml2.so/libxml[0-9].so/libxml[num].so/libxml[0-9]/|/
|
||||
/libfribidi.so.0/libfribidi.so/libfribidi/|/
|
||||
/libattr.so.1/libattr.so/libattr/|/
|
||||
/libX11-xcb.so.1/libX11-xcb.so/libX11-xcb/|/
|
||||
/libcap.so.2/libcap.so/|/
|
||||
/libasound.so.2/libasound.so/libasound/|/
|
||||
/libcaca.so.0/libcaca.so/|/
|
||||
/libts-0.0.so.0/libts-0.[num].so/libts-[0-9].[num].so/libts-/|/
|
||||
/libglapi.so.0/libglapi.so/libglapi/|/
|
||||
/libxcb-glx.so.0/libxcb-glx.so/libxcb-glx/|/
|
||||
/libp11-kit.so.0/libp11-kit.so/libp11-kit/|/
|
||||
/libjson.so.0/libjson.so/|/
|
||||
/libslang.so.2/libslang.so/libslang/|/
|
||||
/libncursesw.so.5/libncursesw.so/libncursesw/|/
|
||||
/libtinfo.so.5/libtinfo.so/libtinfo/|/
|
||||
/libasyncns.so.0/libasyncns.so/libasyncns/|/
|
||||
/libpng15.so.15/libpng1[0-9].so/libpng[num].so/libpng[0-9]/libpng/|/"
|
||||
if [ "$OperatingMode" = "--game" ]; then
|
||||
libs_list="$libs_list
|
||||
/libopenal.so.1/libopenal.so/libopenal/|/
|
||||
/libvlccore.so.5/libvlccore.so/libvlccore/|/
|
||||
/libvlc.so.5/libvlc.so/|/
|
||||
/libvorbisfile.so.3/libvorbisfile.so/libvorbisfile/|/"
|
||||
else
|
||||
libs_list="$libs_list
|
||||
/libwx_gtk2u_core-2.8.so.0/libwx_gtk2u_core-2.[num].so/libwx_gtk2u_core-[0-9]/libwx_gtk[0-9]u_core-/libwx_gtk[0-9]u_core/|/
|
||||
/libwx_baseu-2.8.so.0/libwx_baseu-2.[num].so/libwx_baseu-[0-9]/libwx_baseu-/|/
|
||||
/libwx_gtk2u_gl-2.8.so.0/libwx_gtk2u_gl-2.[num].so/libwx_gtk[0-9]u_gl-/libwx_gtk[0-9]u_gl/|/"
|
||||
fi
|
||||
#if [ "$ARCHITECTURE" = "x86_64" ]; then
|
||||
#else
|
||||
#fi
|
||||
|
||||
checkLibsStatus "$libs_list"
|
||||
if [ -f "$GAMEDIR/megaglest-configure-desktop.sh" ]; then
|
||||
$GAMEDIR/megaglest-configure-desktop.sh
|
||||
rm -f $GAMEDIR/megaglest-configure-desktop.sh
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo 'Found LDCONFIG environment variable ['"$LDCONFIG"']...' >&2
|
||||
ExitStatus="$2"
|
||||
LibsWarnings="$3"
|
||||
BeginTime="$4"
|
||||
ErrorTime="$5"
|
||||
fi
|
||||
|
||||
|
||||
# now deal with the openal library [libopenal.so.0]
|
||||
OS_TYPE=`uname -m`
|
||||
|
||||
# OpenSuSE (11.3) and Fedora needs its own openAL
|
||||
#if [ -f /etc/SuSE-release -a -f lib/libopenal* ]; then
|
||||
if [ -f /etc/SuSE-release ] || [ -f /etc/fedora-release ] ; then
|
||||
|
||||
if [ -f /etc/SuSE-release ] ; then
|
||||
echo 'Detected Open Suse...' >&2
|
||||
fi
|
||||
|
||||
if [ -f /etc/fedora-release ] ; then
|
||||
echo 'Detected Fedora...' >&2
|
||||
fi
|
||||
|
||||
#rm -f lib/libopenal*
|
||||
# libcurl*, libgnu*, libicu*, liblua*, libxerces*
|
||||
#mv `ls -1 | grep -v '\.abc$' | grep -v '\.xyz$' | xargs`
|
||||
|
||||
if [ ! -d lib_bkp ]; then
|
||||
mkdir lib_bkp
|
||||
mv lib/* lib_bkp/
|
||||
cp lib_bkp/libcurl* lib/
|
||||
cp lib_bkp/libgnu* lib/
|
||||
cp lib_bkp/libicu* lib/
|
||||
cp lib_bkp/liblua* lib/
|
||||
cp lib_bkp/libxerces* lib/
|
||||
fi
|
||||
if [ "$OperatingMode" = "--game" ]; then
|
||||
if [ -d "$GAMEDIR/$LIBDIR" ]; then
|
||||
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}${GAMEDIR}/${LIBDIR}"
|
||||
fi
|
||||
$GAMEDIR/megaglest $@
|
||||
ExitStatus="$?"
|
||||
fi
|
||||
|
||||
OPENAL_LINKEDLIBNAME='libopenal.so.0'
|
||||
OPENAL_LIBLOOKUP1=${OPENAL_LINKEDLIBNAME}
|
||||
OPENAL_LIBLOOKUP2='libopenal.so.'
|
||||
|
||||
DIRECTFB_LINKEDLIBNAME='libdirectfb-1.0.so.0'
|
||||
DIRECTFB_LIBLOOKUP1=${DIRECTFB_LINKEDLIBNAME}
|
||||
DIRECTFB_LIBLOOKUP2='libdirectfb-'
|
||||
|
||||
FUSION_LINKEDLIBNAME='libfusion-1.0.so.0'
|
||||
FUSION_LIBLOOKUP1=${DIRECTFB_LINKEDLIBNAME}
|
||||
FUSION_LIBLOOKUP2='libfusion-'
|
||||
|
||||
DIRECT_LINKEDLIBNAME='libdirect-1.0.so.0'
|
||||
DIRECT_LIBLOOKUP1=${DIRECT_LINKEDLIBNAME}
|
||||
DIRECT_LIBLOOKUP2='libdirect-'
|
||||
|
||||
JPG_LINKEDLIBNAME='libjpeg.so.62'
|
||||
JPG_LIBLOOKUP1=${JPG_LINKEDLIBNAME}
|
||||
JPG_LIBLOOKUP2='libjpeg.so'
|
||||
|
||||
PNG_LINKEDLIBNAME='libpng15.so.15'
|
||||
PNG_LIBLOOKUP1=${PNG_LINKEDLIBNAME}
|
||||
PNG_LIBLOOKUP2='libpng'
|
||||
|
||||
CURL_LINKEDLIBNAME='libcurl.so.4'
|
||||
CURL_LIBLOOKUP1=${CURL_LINKEDLIBNAME}
|
||||
CURL_LIBLOOKUP2='libcurl.so.'
|
||||
|
||||
XERCES_LINKEDLIBNAME='libxerces-c-3.1.so'
|
||||
XERCES_LIBLOOKUP1=${XERCES_LINKEDLIBNAME}
|
||||
XERCES_LIBLOOKUP2='libxerces-c'
|
||||
|
||||
ICUDATA_LINKEDLIBNAME='libicudata.so.38'
|
||||
ICUDATA_LIBLOOKUP1=${ICUDATA_LINKEDLIBNAME}
|
||||
ICUDATA_LIBLOOKUP2='libicudata.so.'
|
||||
|
||||
ICUUC_LINKEDLIBNAME='libicuuc.so.38'
|
||||
ICUUC_LIBLOOKUP1=${ICUUC_LINKEDLIBNAME}
|
||||
ICUUC_LIBLOOKUP2='libicuuc.so.'
|
||||
|
||||
GLEW_LINKEDLIBNAME='libGLEW.so.1.5'
|
||||
GLEW_LIBLOOKUP1=${GLEW_LINKEDLIBNAME}
|
||||
GLEW_LIBLOOKUP2='libGLEW.so.'
|
||||
GLEW_LIBLOOKUP3='libglew.so.'
|
||||
|
||||
OGG_LINKEDLIBNAME='libogg.so.0'
|
||||
OGG_LIBLOOKUP1=${OGG_LINKEDLIBNAME}
|
||||
OGG_LIBLOOKUP2='libogg.so.'
|
||||
|
||||
VORBIS_LINKEDLIBNAME='libvorbis.so.0'
|
||||
VORBIS_LIBLOOKUP1=${VORBIS_LINKEDLIBNAME}
|
||||
VORBIS_LIBLOOKUP2='libvorbis.so.'
|
||||
|
||||
VORBISFILE_LINKEDLIBNAME='libvorbisfile.so.3'
|
||||
VORBISFILE_LIBLOOKUP1=${VORBISFILE_LINKEDLIBNAME}
|
||||
VORBISFILE_LIBLOOKUP2='libvorbisfile.so.'
|
||||
|
||||
FONTCONFIG_LINKEDLIBNAME='libfontconfig.so.1'
|
||||
FONTCONFIG_LIBLOOKUP1=${FONTCONFIG_LINKEDLIBNAME}
|
||||
FONTCONFIG_LIBLOOKUP2='libfontconfig.so.'
|
||||
|
||||
FREETYPE_LINKEDLIBNAME='libfreetype.so.6'
|
||||
FREETYPE_LIBLOOKUP1=${FREETYPE_LINKEDLIBNAME}
|
||||
FREETYPE_LIBLOOKUP2='libfreetype.so.'
|
||||
|
||||
GNUTLS_LINKEDLIBNAME='libgnutls.so.26'
|
||||
GNUTLS_LIBLOOKUP1=${GNUTLS_LINKEDLIBNAME}
|
||||
GNUTLS_LIBLOOKUP2='libgnutls.so.'
|
||||
|
||||
LDAP_LINKEDLIBNAME='libldap_r-2.4.so.2'
|
||||
LDAP_LIBLOOKUP1=${LDAP_LINKEDLIBNAME}
|
||||
LDAP_LIBLOOKUP2='libldap_r-'
|
||||
|
||||
RESOLV_LINKEDLIBNAME='libresolv.so.2'
|
||||
RESOLV_LIBLOOKUP1=${RESOLV_LINKEDLIBNAME}
|
||||
RESOLV_LIBLOOKUP2='libresolv.so.'
|
||||
|
||||
LUA_LINKEDLIBNAME='liblua5.1.so.0'
|
||||
LUA_LIBLOOKUP1=${LUA_LINKEDLIBNAME}
|
||||
LUA_LIBLOOKUP2='liblua.so.'
|
||||
|
||||
FTGL_LINKEDLIBNAME='libftgl.so.2'
|
||||
FTGL_LIBLOOKUP1=${FTGL_LINKEDLIBNAME}
|
||||
FTGL_LIBLOOKUP2='libftgl.so.'
|
||||
|
||||
IRC_LINKEDLIBNAME='libircclient.so.1'
|
||||
IRC_LIBLOOKUP1=${IRC_LINKEDLIBNAME}
|
||||
IRC_LIBLOOKUP2='libircclient.so.'
|
||||
|
||||
DL_LINKEDLIBNAME='libdl.so.2'
|
||||
DL_LIBLOOKUP1=${DL_LINKEDLIBNAME}
|
||||
DL_LIBLOOKUP2='libdl.so.'
|
||||
|
||||
VLC_LINKEDLIBNAME='libvlc.so.5'
|
||||
VLC_LIBLOOKUP1=${VLC_LINKEDLIBNAME}
|
||||
VLC_LIBLOOKUP2='libvlc.so.'
|
||||
|
||||
VLCCORE_LINKEDLIBNAME='libvlccore.so.5'
|
||||
VLCCORE_LIBLOOKUP1=${VLCCORE_LINKEDLIBNAME}
|
||||
VLCCORE_LIBLOOKUP2='libvlccore.so.'
|
||||
|
||||
GCRYPT_LINKEDLIBNAME='libgcrypt.so.11'
|
||||
GCRYPT_LIBLOOKUP1=${GCRYPT_LINKEDLIBNAME}
|
||||
GCRYPT_LIBLOOKUP2='libgcrypt.so.'
|
||||
|
||||
TASN_LINKEDLIBNAME='libtasn1.so.3'
|
||||
TASN_LIBLOOKUP1=${TASN_LINKEDLIBNAME}
|
||||
TASN_LIBLOOKUP2='libtasn1.so.'
|
||||
|
||||
RTMP_LINKEDLIBNAME='librtmp.so.0'
|
||||
RTMP_LIBLOOKUP1=${RTMP_LINKEDLIBNAME}
|
||||
RTMP_LIBLOOKUP2='librtmp.so.'
|
||||
|
||||
|
||||
if [ "$OS_TYPE"'_' = 'x86_64_' ]; then
|
||||
DIRECTFB_LINKEDLIBNAME='libdirectfb-1.2.so.0'
|
||||
DIRECTFB_LIBLOOKUP1=${DIRECTFB_LINKEDLIBNAME}
|
||||
DIRECTFB_LIBLOOKUP2='libdirectfb-'
|
||||
|
||||
FUSION_LINKEDLIBNAME='libfusion-1.2.so.0'
|
||||
FUSION_LIBLOOKUP1=${DIRECTFB_LINKEDLIBNAME}
|
||||
FUSION_LIBLOOKUP2='libfusion-'
|
||||
|
||||
DIRECT_LINKEDLIBNAME='libdirect-1.2.so.0'
|
||||
DIRECT_LIBLOOKUP1=${DIRECT_LINKEDLIBNAME}
|
||||
DIRECT_LIBLOOKUP2='libdirect-'
|
||||
|
||||
OPENAL_LINKEDLIBNAME='libopenal.so.1'
|
||||
OPENAL_LIBLOOKUP1=${OPENAL_LINKEDLIBNAME}
|
||||
OPENAL_LIBLOOKUP2='libopenal.so.'
|
||||
|
||||
ICUDATA_LINKEDLIBNAME='libicudata.so.40'
|
||||
ICUDATA_LIBLOOKUP1=${ICUDATA_LINKEDLIBNAME}
|
||||
ICUDATA_LIBLOOKUP2='libicudata.so.'
|
||||
|
||||
ICUUC_LINKEDLIBNAME='libicuuc.so.40'
|
||||
ICUUC_LIBLOOKUP1=${ICUUC_LINKEDLIBNAME}
|
||||
ICUUC_LIBLOOKUP2='libicuuc.so.'
|
||||
|
||||
GNUTLS_LINKEDLIBNAME='libgnutls.so.26'
|
||||
GNUTLS_LIBLOOKUP1=${GNUTLS_LINKEDLIBNAME}
|
||||
GNUTLS_LIBLOOKUP2='libgnutls.so.'
|
||||
|
||||
GCRYPT_LINKEDLIBNAME='libgcrypt.so.11'
|
||||
GCRYPT_LIBLOOKUP1=${GCRYPT_LINKEDLIBNAME}
|
||||
GCRYPT_LIBLOOKUP2='libgcrypt.so.'
|
||||
|
||||
if [ "$ExitStatus" -ne "0" ] || [ "$OperatingMode" = "--tool-editor" ] || [ "$OperatingMode" = "--tool-g3dviewer" ]; then
|
||||
if [ "$OperatingMode" = "--game" ]; then ErrorTime="$(date +"%s")"; fi
|
||||
DiffTime="$(($ErrorTime-$BeginTime))"
|
||||
if [ "$DiffTime" -le "15" ]; then
|
||||
echo "$LibsWarnings" | sed 's/^[\t ]*||//g' >&2; echo
|
||||
if [ "$IgnoredLibs" != "" ]; then
|
||||
echo "... and as information useful only for game developers, List of ignored libs:" >&2
|
||||
echo "$IgnoredLibs" >&2; echo
|
||||
fi
|
||||
else
|
||||
BugReportInfo="$BugReportInfo
|
||||
|| OS info. [$OS_INFO], Arch.[$ARCHITECTURE], Dir.[$GAMEDIR]
|
||||
||
|
||||
|| If you see an unknown error then please report a bug
|
||||
|| here: $BugReport1
|
||||
|| or here: $BugReport2."
|
||||
echo "$BugReportInfo" | sed 's/^[\t ]*||//g' >&2; echo
|
||||
fi
|
||||
#if [ "$OperatingMode" = "--game" ] && [ -f "$GAMEDIR/megaglest-mini-update.sh" ]; then
|
||||
#echo "... attempt to perform mini update, which may solve tiny problems:" >&2
|
||||
#$GAMEDIR/megaglest-mini-update.sh
|
||||
#fi
|
||||
fi
|
||||
|
||||
|
||||
#if [ "$OS_TYPE"'_' = 'x86_64_' ]; then
|
||||
# OPENAL_LIBLOOKUP1="${OPENAL_LIBLOOKUP1}"' (libc6)'
|
||||
# OPENAL_LIBLOOKUP2="${OPENAL_LIBLOOKUP2}"' (libc6)'
|
||||
#
|
||||
# DIRECTFB_LIBLOOKUP1="${DIRECTFB_LIBLOOKUP1}"' (libc6)'
|
||||
# DIRECTFB_LIBLOOKUP2="${DIRECTFB_LIBLOOKUP2}"' (libc6)'
|
||||
#
|
||||
# FUSION_LIBLOOKUP1="${FUSION_LIBLOOKUP1}"' (libc6)'
|
||||
# FUSION_LIBLOOKUP2="${FUSION_LIBLOOKUP2}"' (libc6)'
|
||||
#
|
||||
# DIRECT_LIBLOOKUP1="${DIRECT_LIBLOOKUP1}"' (libc6)'
|
||||
# DIRECT_LIBLOOKUP2="${DIRECT_LIBLOOKUP2}"' (libc6)'
|
||||
#fi
|
||||
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${OPENAL_LINKEDLIBNAME}" "$OPENAL_LIBLOOKUP1" "$OPENAL_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${DIRECTFB_LINKEDLIBNAME}" "$DIRECTFB_LIBLOOKUP1" "$DIRECTFB_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${FUSION_LINKEDLIBNAME}" "$FUSION_LIBLOOKUP1" "$FUSION_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${DIRECT_LINKEDLIBNAME}" "$DIRECT_LIBLOOKUP1" "$DIRECT_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${JPG_LINKEDLIBNAME}" "$JPG_LIBLOOKUP1" "$JPG_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${PNG_LINKEDLIBNAME}" "$PNG_LIBLOOKUP1" "$PNG_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${CURL_LINKEDLIBNAME}" "$CURL_LIBLOOKUP1" "$CURL_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${XERCES_LINKEDLIBNAME}" "$XERCES_LIBLOOKUP1" "$XERCES_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${ICUDATA_LINKEDLIBNAME}" "$ICUDATA_LIBLOOKUP1" "$ICUDATA_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${ICUUC_LINKEDLIBNAME}" "$ICUUC_LIBLOOKUP1" "$ICUUC_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${GLEW_LINKEDLIBNAME}" "$GLEW_LIBLOOKUP1" "$GLEW_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${GLEW_LINKEDLIBNAME}" "$GLEW_LIBLOOKUP1" "$GLEW_LIBLOOKUP3"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${OGG_LINKEDLIBNAME}" "$OGG_LIBLOOKUP1" "$OGG_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${VORBIS_LINKEDLIBNAME}" "$VORBIS_LIBLOOKUP1" "$VORBIS_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${VORBISFILE_LINKEDLIBNAME}" "$VORBISFILE_LIBLOOKUP1" "$VORBISFILE_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${FONTCONFIG_LINKEDLIBNAME}" "$FONTCONFIG_LIBLOOKUP1" "$FONTCONFIG_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${FREETYPE_LINKEDLIBNAME}" "$FREETYPE_LIBLOOKUP1" "$FREETYPE_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${GNUTLS_LINKEDLIBNAME}" "$GNUTLS_LIBLOOKUP1" "$GNUTLS_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${LDAP_LINKEDLIBNAME}" "$LDAP_LIBLOOKUP1" "$LDAP_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${RESOLV_LINKEDLIBNAME}" "$RESOLV_LIBLOOKUP1" "$RESOLV_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${LUA_LINKEDLIBNAME}" "$LUA_LIBLOOKUP1" "$LUA_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${FTGL_LINKEDLIBNAME}" "$FTGL_LIBLOOKUP1" "$FTGL_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${IRC_LINKEDLIBNAME}" "$IRC_LIBLOOKUP1" "$IRC_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${DL_LINKEDLIBNAME}" "$DL_LIBLOOKUP1" "$DL_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${VLCCORE_LINKEDLIBNAME}" "$VLCCORE_LIBLOOKUP1" "$VLCCORE_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${VLC_LINKEDLIBNAME}" "$VLC_LIBLOOKUP1" "$VLC_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${GCRYPT_LINKEDLIBNAME}" "$GCRYPT_LIBLOOKUP1" "$GCRYPT_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${TASN_LINKEDLIBNAME}" "$TASN_LIBLOOKUP1" "$TASN_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${RTMP_LINKEDLIBNAME}" "$RTMP_LIBLOOKUP1" "$RTMP_LIBLOOKUP2"
|
||||
|
||||
./megaglest $@
|
||||
|
||||
# Other ways to start MegaGlest (for testing purposes)
|
||||
#
|
||||
# Write verbose output (stout+stderr) to a gzip compressed file (only)
|
||||
#./megaglest $@ --verbose 2>&1 | gzip > ~/.megaglest/verbose.log.gz
|
||||
#
|
||||
# Create a new date/time indexed log file for every MG run and keep it;
|
||||
# write output (stout+stderr) both to this file and to the screen
|
||||
#./megaglest $@ 2>&1 | tee -a /tmp/`date +"%F_%k-%M-%S"`.glest.log 2>&1
|
||||
|
||||
exit $?
|
||||
exit $ExitStatus
|
||||
|
|
|
@ -1,123 +1,16 @@
|
|||
#!/bin/sh
|
||||
# 2014 Written by filux <heross(@@)o2.pl>
|
||||
# Copyright (c) 2014-2015 under GNU GPL v3.0+
|
||||
# ----------------------------------------------------------------------------
|
||||
LANG=C
|
||||
|
||||
findMissingSO () {
|
||||
|
||||
LDCONFIG="$1"
|
||||
SO_LINKEDLIBNAME="$2"
|
||||
SO_LIBLOOKUP1="$3"
|
||||
SO_LIBLOOKUP2="$4"
|
||||
|
||||
hasSO=`$LDCONFIG -p | grep -m 1 "$SO_LIBLOOKUP1" | cut "-d>" -f2 | cut "-d " -f2`
|
||||
if [ -n "$hasSO" ]; then
|
||||
echo default library [$SO_LINKEDLIBNAME] was found in [$hasSO]
|
||||
else
|
||||
echo default library [$SO_LINKEDLIBNAME] is missing, attempting to find and link to a newer version if available...
|
||||
|
||||
hasSO=`$LDCONFIG -p | grep -m 1 "$SO_LIBLOOKUP2" | cut "-d>" -f2 | cut "-d " -f2`
|
||||
if [ -n "$hasSO" ]; then
|
||||
echo new library link [$hasSO] pointed to from [$SO_LINKEDLIBNAME]
|
||||
ln -f -s $hasSO $SO_LINKEDLIBNAME
|
||||
fi
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# Library directory
|
||||
SCRIPTLOCATION="$(readlink -f "$0")"
|
||||
GAMEDIR="$(dirname "$SCRIPTLOCATION")"
|
||||
LIBDIR="lib"
|
||||
|
||||
# As a first step to determine the absolute path of the directory the game
|
||||
# resides in, dereference symlinks to this script and convert relative to
|
||||
# absolute paths along the way.
|
||||
MYLOCATION="`readlink -f $0`"
|
||||
|
||||
# The game directory is the directory the script resides in
|
||||
GAMEDIR="`dirname $MYLOCATION`"
|
||||
|
||||
# export game library directory
|
||||
test -n "${LIBDIR}" && export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GAMEDIR}/${LIBDIR}"
|
||||
|
||||
# ensure ldconfig is found (was an issue on OpenSuSE 11.2)
|
||||
echo Looking for LDCONFIG [$LDCONFIG]... >&2
|
||||
|
||||
if [ "$LDCONFIG"'x' = 'x' ] # 'LDCONFIG' environment variable, if set, overrides the following detection
|
||||
then
|
||||
echo 'Looking for LDCONFIG environment var not found...' >&2
|
||||
if [ `which ldconfig 2>/dev/null` ]
|
||||
then
|
||||
LDCONFIG=`which ldconfig 2>/dev/null`
|
||||
|
||||
echo Found LDCONFIG using which [$LDCONFIG]... >&2
|
||||
else
|
||||
if [ -x /sbin/ldconfig ]
|
||||
then
|
||||
LDCONFIG=/sbin/ldconfig
|
||||
echo Found LDCONFIG in sbin [$LDCONFIG]... >&2
|
||||
# optionally add more custom locations using 'elseif' here
|
||||
else
|
||||
echo 'ERROR: Could not find the "ldconfig" command.' >&2
|
||||
echo 'Try running "LDCONFIG=`which ldconfig` '"$0"' instead.' >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
WARNINGS="$($GAMEDIR/start_megaglest --tool-g3dviewer 2>&1)"
|
||||
if [ -d "$GAMEDIR/$LIBDIR" ]; then
|
||||
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}${GAMEDIR}/${LIBDIR}"
|
||||
fi
|
||||
|
||||
|
||||
# now deal with the openal library [libopenal.so.0]
|
||||
OS_TYPE=`uname -m`
|
||||
|
||||
# Suse needs its own openAL
|
||||
if [ -f /etc/SuSE-release ]; then
|
||||
rm lib/libopenal*
|
||||
fi
|
||||
|
||||
OPENAL_LINKEDLIBNAME="libopenal.so.0"
|
||||
OPENAL_LIBLOOKUP1=${OPENAL_LINKEDLIBNAME}
|
||||
OPENAL_LIBLOOKUP2="libopenal.so.1"
|
||||
|
||||
DIRECTFB_LINKEDLIBNAME="libdirectfb-1.0.so.0"
|
||||
DIRECTFB_LIBLOOKUP1=${DIRECTFB_LINKEDLIBNAME}
|
||||
DIRECTFB_LIBLOOKUP2="libdirectfb-"
|
||||
|
||||
FUSION_LINKEDLIBNAME="libfusion-1.0.so.0"
|
||||
FUSION_LIBLOOKUP1=${DIRECTFB_LINKEDLIBNAME}
|
||||
FUSION_LIBLOOKUP2="libfusion-"
|
||||
|
||||
DIRECT_LINKEDLIBNAME="libdirect-1.0.so.0"
|
||||
DIRECT_LIBLOOKUP1=${DIRECT_LINKEDLIBNAME}
|
||||
DIRECT_LIBLOOKUP2="libdirect-"
|
||||
|
||||
if [ "$OS_TYPE" = "x86_64" ]; then
|
||||
DIRECTFB_LINKEDLIBNAME="libdirectfb-1.2.so.0"
|
||||
DIRECTFB_LIBLOOKUP1=${DIRECTFB_LINKEDLIBNAME}
|
||||
DIRECTFB_LIBLOOKUP2="libdirectfb-"
|
||||
|
||||
FUSION_LINKEDLIBNAME="libfusion-1.2.so.0"
|
||||
FUSION_LIBLOOKUP1=${DIRECTFB_LINKEDLIBNAME}
|
||||
FUSION_LIBLOOKUP2="libfusion-"
|
||||
|
||||
DIRECT_LINKEDLIBNAME="libdirect-1.2.so.0"
|
||||
DIRECT_LIBLOOKUP1=${DIRECT_LINKEDLIBNAME}
|
||||
DIRECT_LIBLOOKUP2="libdirect-"
|
||||
fi
|
||||
|
||||
#if [ "$OS_TYPE" = "x86_64" ]; then
|
||||
# OPENAL_LIBLOOKUP1="${OPENAL_LIBLOOKUP1} (libc6)"
|
||||
# OPENAL_LIBLOOKUP2="${OPENAL_LIBLOOKUP2} (libc6)"
|
||||
|
||||
# DIRECTFB_LIBLOOKUP1="${DIRECTFB_LIBLOOKUP1} (libc6)"
|
||||
# DIRECTFB_LIBLOOKUP2="${DIRECTFB_LIBLOOKUP2} (libc6)"
|
||||
|
||||
# FUSION_LIBLOOKUP1="${FUSION_LIBLOOKUP1} (libc6)"
|
||||
# FUSION_LIBLOOKUP2="${FUSION_LIBLOOKUP2} (libc6)"
|
||||
|
||||
# DIRECT_LIBLOOKUP1="${DIRECT_LIBLOOKUP1} (libc6)"
|
||||
# DIRECT_LIBLOOKUP2="${DIRECT_LIBLOOKUP2} (libc6)"
|
||||
#fi
|
||||
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${OPENAL_LINKEDLIBNAME}" "$OPENAL_LIBLOOKUP1" "$OPENAL_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${DIRECTFB_LINKEDLIBNAME}" "$DIRECTFB_LIBLOOKUP1" "$DIRECTFB_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${FUSION_LINKEDLIBNAME}" "$FUSION_LIBLOOKUP1" "$FUSION_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${DIRECT_LINKEDLIBNAME}" "$DIRECT_LIBLOOKUP1" "$DIRECT_LIBLOOKUP2"
|
||||
|
||||
"$GAMEDIR/megaglest_g3dviewer" $@
|
||||
BeginTime="$(date +"%s")"
|
||||
$GAMEDIR/megaglest_g3dviewer $@
|
||||
$GAMEDIR/start_megaglest --tool-buginfo "$?" "$WARNINGS" "$BeginTime" "$(date +"%s")"
|
||||
|
|
|
@ -1,123 +1,16 @@
|
|||
#!/bin/sh
|
||||
# 2014 Written by filux <heross(@@)o2.pl>
|
||||
# Copyright (c) 2014-2015 under GNU GPL v3.0+
|
||||
# ----------------------------------------------------------------------------
|
||||
LANG=C
|
||||
|
||||
findMissingSO () {
|
||||
|
||||
LDCONFIG="$1"
|
||||
SO_LINKEDLIBNAME="$2"
|
||||
SO_LIBLOOKUP1="$3"
|
||||
SO_LIBLOOKUP2="$4"
|
||||
|
||||
hasSO=`$LDCONFIG -p | grep -m 1 "$SO_LIBLOOKUP1" | cut "-d>" -f2 | cut "-d " -f2`
|
||||
if [ -n "$hasSO" ]; then
|
||||
echo default library [$SO_LINKEDLIBNAME] was found in [$hasSO]
|
||||
else
|
||||
echo default library [$SO_LINKEDLIBNAME] is missing, attempting to find and link to a newer version if available...
|
||||
|
||||
hasSO=`$LDCONFIG -p | grep -m 1 "$SO_LIBLOOKUP2" | cut "-d>" -f2 | cut "-d " -f2`
|
||||
if [ -n "$hasSO" ]; then
|
||||
echo new library link [$hasSO] pointed to from [$SO_LINKEDLIBNAME]
|
||||
ln -f -s $hasSO $SO_LINKEDLIBNAME
|
||||
fi
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# Library directory
|
||||
SCRIPTLOCATION="$(readlink -f "$0")"
|
||||
GAMEDIR="$(dirname "$SCRIPTLOCATION")"
|
||||
LIBDIR="lib"
|
||||
|
||||
# As a first step to determine the absolute path of the directory the game
|
||||
# resides in, dereference symlinks to this script and convert relative to
|
||||
# absolute paths along the way.
|
||||
MYLOCATION="`readlink -f $0`"
|
||||
|
||||
# The game directory is the directory the script resides in
|
||||
GAMEDIR="`dirname $MYLOCATION`"
|
||||
|
||||
# export game library directory
|
||||
test -n "${LIBDIR}" && export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GAMEDIR}/${LIBDIR}"
|
||||
|
||||
# ensure ldconfig is found (was an issue on OpenSuSE 11.2)
|
||||
echo Looking for LDCONFIG [$LDCONFIG]... >&2
|
||||
|
||||
if [ "$LDCONFIG"'x' = 'x' ] # 'LDCONFIG' environment variable, if set, overrides the following detection
|
||||
then
|
||||
echo 'Looking for LDCONFIG environment var not found...' >&2
|
||||
if [ `which ldconfig 2>/dev/null` ]
|
||||
then
|
||||
LDCONFIG=`which ldconfig 2>/dev/null`
|
||||
|
||||
echo Found LDCONFIG using which [$LDCONFIG]... >&2
|
||||
else
|
||||
if [ -x /sbin/ldconfig ]
|
||||
then
|
||||
LDCONFIG=/sbin/ldconfig
|
||||
echo Found LDCONFIG in sbin [$LDCONFIG]... >&2
|
||||
# optionally add more custom locations using 'elseif' here
|
||||
else
|
||||
echo 'ERROR: Could not find the "ldconfig" command.' >&2
|
||||
echo 'Try running "LDCONFIG=`which ldconfig` '"$0"' instead.' >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
WARNINGS="$($GAMEDIR/start_megaglest --tool-editor 2>&1)"
|
||||
if [ -d "$GAMEDIR/$LIBDIR" ]; then
|
||||
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}${GAMEDIR}/${LIBDIR}"
|
||||
fi
|
||||
|
||||
|
||||
# now deal with the openal library [libopenal.so.0]
|
||||
OS_TYPE=`uname -m`
|
||||
|
||||
# Suse needs its own openAL
|
||||
if [ -f /etc/SuSE-release ]; then
|
||||
rm lib/libopenal*
|
||||
fi
|
||||
|
||||
OPENAL_LINKEDLIBNAME="libopenal.so.0"
|
||||
OPENAL_LIBLOOKUP1=${OPENAL_LINKEDLIBNAME}
|
||||
OPENAL_LIBLOOKUP2="libopenal.so.1"
|
||||
|
||||
DIRECTFB_LINKEDLIBNAME="libdirectfb-1.0.so.0"
|
||||
DIRECTFB_LIBLOOKUP1=${DIRECTFB_LINKEDLIBNAME}
|
||||
DIRECTFB_LIBLOOKUP2="libdirectfb-"
|
||||
|
||||
FUSION_LINKEDLIBNAME="libfusion-1.0.so.0"
|
||||
FUSION_LIBLOOKUP1=${DIRECTFB_LINKEDLIBNAME}
|
||||
FUSION_LIBLOOKUP2="libfusion-"
|
||||
|
||||
DIRECT_LINKEDLIBNAME="libdirect-1.0.so.0"
|
||||
DIRECT_LIBLOOKUP1=${DIRECT_LINKEDLIBNAME}
|
||||
DIRECT_LIBLOOKUP2="libdirect-"
|
||||
|
||||
if [ "$OS_TYPE" = "x86_64" ]; then
|
||||
DIRECTFB_LINKEDLIBNAME="libdirectfb-1.2.so.0"
|
||||
DIRECTFB_LIBLOOKUP1=${DIRECTFB_LINKEDLIBNAME}
|
||||
DIRECTFB_LIBLOOKUP2="libdirectfb-"
|
||||
|
||||
FUSION_LINKEDLIBNAME="libfusion-1.2.so.0"
|
||||
FUSION_LIBLOOKUP1=${DIRECTFB_LINKEDLIBNAME}
|
||||
FUSION_LIBLOOKUP2="libfusion-"
|
||||
|
||||
DIRECT_LINKEDLIBNAME="libdirect-1.2.so.0"
|
||||
DIRECT_LIBLOOKUP1=${DIRECT_LINKEDLIBNAME}
|
||||
DIRECT_LIBLOOKUP2="libdirect-"
|
||||
fi
|
||||
|
||||
#if [ "$OS_TYPE" = "x86_64" ]; then
|
||||
# OPENAL_LIBLOOKUP1="${OPENAL_LIBLOOKUP1} (libc6)"
|
||||
# OPENAL_LIBLOOKUP2="${OPENAL_LIBLOOKUP2} (libc6)"
|
||||
|
||||
# DIRECTFB_LIBLOOKUP1="${DIRECTFB_LIBLOOKUP1} (libc6)"
|
||||
# DIRECTFB_LIBLOOKUP2="${DIRECTFB_LIBLOOKUP2} (libc6)"
|
||||
|
||||
# FUSION_LIBLOOKUP1="${FUSION_LIBLOOKUP1} (libc6)"
|
||||
# FUSION_LIBLOOKUP2="${FUSION_LIBLOOKUP2} (libc6)"
|
||||
|
||||
# DIRECT_LIBLOOKUP1="${DIRECT_LIBLOOKUP1} (libc6)"
|
||||
# DIRECT_LIBLOOKUP2="${DIRECT_LIBLOOKUP2} (libc6)"
|
||||
#fi
|
||||
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${OPENAL_LINKEDLIBNAME}" "$OPENAL_LIBLOOKUP1" "$OPENAL_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${DIRECTFB_LINKEDLIBNAME}" "$DIRECTFB_LIBLOOKUP1" "$DIRECTFB_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${FUSION_LINKEDLIBNAME}" "$FUSION_LIBLOOKUP1" "$FUSION_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${DIRECT_LINKEDLIBNAME}" "$DIRECT_LIBLOOKUP1" "$DIRECT_LIBLOOKUP2"
|
||||
|
||||
"$GAMEDIR/megaglest_editor" $@
|
||||
BeginTime="$(date +"%s")"
|
||||
$GAMEDIR/megaglest_editor $@
|
||||
$GAMEDIR/start_megaglest --tool-buginfo "$?" "$WARNINGS" "$BeginTime" "$(date +"%s")"
|
||||
|
|
Loading…
Reference in New Issue