Files
swg/include/swginit.sh
Tekaoh 72761aec31 Add local_machine_options.iff
Swg seems to run fine without this, but the console complains that it's 
not there so whatever.
2019-10-09 19:34:58 -05:00

107 lines
5.1 KiB
Bash
Executable File

#!/bin/bash
HOSTIP=
CLIUSTERNAME=
basedir=$PWD
#user input
echo "Please enter your IP address. "
read HOSTIP
echo "What would you like to call your server? "
read CLUSTERNAME
#get some dependencies
sudo apt-get update
sudo apt-get install alien bc bison build-essential clang clang-3.9 cmake default-jdk flex g++-6-multilib gcc-6-multilib git-core lib32ncurses5 lib32z1 libaio1 libaio1:i386 libboost-dev libc6-dbg libc6-dbg:i386 libc6-dev:i386 libc6-i686:i386 libc6:i386 libcurl4-gnutls-dev:i386 libgcc1:i386 libncurses5-dev:i386 libpcre3-dev:i386 libxml2-dev:i386 linux-libc-dev:i386 openjdk-11-jdk:i386 openjdk-11-jdk psmisc python-ply zlib1g-dev:i386 zlib1g:i386 -y
sudo apt-get remove libncurses-dev:amd64 libxml2-dev:amd64 zlib1g-dev:amd64 -y
#get the oracle instantclients
cd $basedir/include
mkdir ignore
cd ignore
wget https://github.com/tekaohswg/gdown.pl/archive/v1.4.zip
unzip v1.4.zip
rm v1.4.zip
./gdown.pl-1.4/gdown.pl 'https://drive.google.com/open?id=1xb0S2cYAmXZurIkzuUuVOPDw-CcjDioL' 'oracle-instantclient12.2-basiclite-12.2.0.1.0-1.i386.rpm'
./gdown.pl-1.4/gdown.pl 'https://drive.google.com/open?id=15s_e_Z4BMxpAqsIUFwyO1tbM9SS1XFVZ' 'oracle-instantclient12.2-devel-12.2.0.1.0-1.i386.rpm'
./gdown.pl-1.4/gdown.pl 'https://drive.google.com/open?id=1FUVe89ZObP_LQN63xD1kQEpBgTmV3wbX' 'oracle-instantclient12.2-sqlplus-12.2.0.1.0-1.i386.rpm'
#install oracle instantclients
sudo alien -i --target=amd64 oracle-instantclient12.2-basiclite-12.2.0.1.0-1.i386.rpm
sudo alien -i --target=amd64 oracle-instantclient12.2-devel-12.2.0.1.0-1.i386.rpm
sudo alien -i --target=amd64 oracle-instantclient12.2-sqlplus-12.2.0.1.0-1.i386.rpm
#set env vars
sudo find /usr/lib -lname '/usr/lib/oracle/*' -delete &> /dev/null
sudo touch /etc/ld.so.conf.d/oracle.conf
sudo touch /etc/profile.d/oracle.sh
echo "/usr/lib/oracle/12.2/client/lib" | sudo tee -a /etc/ld.so.conf.d/oracle.conf
echo "export ORACLE_HOME=/usr/lib/oracle/12.2/client" | sudo tee -a /etc/profile.d/oracle.sh
echo "export PATH=\$PATH:/usr/lib/oracle/12.2/client/bin" | sudo tee -a /etc/profile.d/oracle.sh
echo "export LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client/lib:/usr/include/oracle/12.2/client" | sudo tee -a /etc/profile.d/oracle.sh
source /etc/profile.d/oracle.sh
sudo ln -s /usr/include/oracle/12.2/client $ORACLE_HOME/include
sudo ldconfig
sudo touch /etc/profile.d/java.sh
echo "export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64" | sudo tee -a /etc/profile.d/java.sh
source /etc/profile.d/java.sh
#grab the swg repos
cd $basedir
git clone https://github.com/SWG-Source/src.git
git clone https://github.com/SWG-Source/dsrc.git
git clone https://github.com/SWG-Source/clientdata.git
git clone https://github.com/SWG-Source/stationapi.git
#build the src
PATH=$PATH:$basedir/build/bin
MODE=Release
mkdir -p $basedir/build/bin
cd $basedir/build
export LDFLAGS=-L/usr/lib32
export CMAKE_PREFIX_PATH="/usr/lib32:/lib32:/usr/lib/i386-linux-gnu:/usr/include/i386-linux-gnu"
cmake -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32 -DCMAKE_EXE_LINKER_FLAGS=-m32 -DCMAKE_MODULE_LINKER_FLAGS=-m32 -DCMAKE_SHARED_LINKER_FLAGS=-m32 -DCMAKE_BUILD_TYPE=$MODE $basedir/src
make -j$(nproc)
strip -s bin/*
#install the cfg
cd $basedir
DBSERVICE=//127.0.0.1/swg
DBUSERNAME=swg
DBPASSWORD=swg
cp $basedir/include/localOptions-template.cfg $basedir/localOptions.cfg
sed -i -e "s@DBSERVICE@$DBSERVICE@g" -e "s@DBUSERNAME@$DBUSERNAME@g" -e "s@DBPASSWORD@$DBPASSWORD@g" -e "s@CLUSTERNAME@$CLUSTERNAME@g" -e "s@HOSTIP@$HOSTIP@g" $basedir/localOptions.cfg
mkdir -p $basedir/exe/linux/logs
ln -s $basedir/build/bin $basedir/exe/linux/bin
ln -s $basedir/include/cfg/shared $basedir/exe/shared
ln -s $basedir/include/cfg/linux/servercommon.cfg $basedir/exe/linux/servercommon.cfg
ln -s $basedir/include/cfg/linux/logServerTargets.cfg $basedir/exe/linux/logServerTargets.cfg
ln -s $basedir/include/cfg/linux/metricsAuthentication.cfg $basedir/exe/linux/metricsAuthentication.cfg
ln -s $basedir/include/cfg/linux/multiserver.cfg $basedir/exe/linux/multiserver.cfg
ln -s $basedir/include/cfg/linux/taskmanager.rc $basedir/exe/linux/taskmanager.rc
ln -s $basedir/include/cfg/linux/local_machine_options.iff $basedir/exe/linux/local_machine_options.iff
#build the dsrc
python $basedir/include/build_dsrc.py
python $basedir/include/build_object_template_crc_string_tables.py
python $basedir/include/build_quest_crc_string_tables.py
$basedir/include/build_miff.sh
mkdir $basedir/data/sku.0/sys.client/compiled
ln -s $basedir/clientdata/ $basedir/data/sku.0/sys.client/compiled/
#build the chat server
cd $basedir/stationapi
./build.sh
mv -T $basedir/stationapi/build/bin $basedir/chat
cd $basedir
#import the database
cd $basedir/src/game/server/database/build/linux
./database_update.pl --username=$DBUSERNAME --password=$DBPASSWORD --service=$DBSERVICE --goldusername=$DBUSERNAME --loginusername=$DBUSERNAME --createnewcluster --packages
cd $basedir
perl $basedir/src/game/server/database/templates/processTemplateList.pl < $basedir/dsrc/sku.0/sys.server/built/game/misc/object_template_crc_string_table.tab > $basedir/build/templates.sql
sqlplus ${DBUSERNAME}/${DBPASSWORD}@${DBSERVICE} @$basedir/build/templates.sql > $basedir/build/templates.out
#done!
touch $basedir/include/ignore/.installed