Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- ##
- ## -------------------------------------------------
- ## | WINE minimal install for ARMA2 servers |
- ## | Author: Vaerraent |
- ## -------------------------------------------------
- ##
- sudoequiv() {
- if type -p sudo >/dev/null; then
- echo "sudo"
- else
- echo "su -c"
- fi
- }
- installdeps() {
- echo "Please enter root password when prompted to install required packages."
- if [ "$DISTRO" == "Debian" ]; then
- $(sudoequiv) 'apt-get install build-essential ia32-libs ia32-libs-dev lib32z1-dev libc6-dev-i386 libncurses5-dev libncurses5-dev libfreetype6-dev libx11-dev lib32ncurses5-dev libxcursor-dev flex bison prelink libjpeg62-dev libpng12-dev'
- elif [ "$DISTRO" == "Ubuntu"]; then
- $(sudoequiv) 'apt-get install build-essential libc6-dev-i386 libncurses5-dev libncurses5-dev libx11-dev lib32ncurses5-dev libfreetype6-dev libxcursor-dev flex bison prelink cabextract libjpeg62-dev libpng12-dev lib32z1-dev libc6 libX11-dev:i386 libpng12:i386 libjpeg62:i386 libfreetype6:i386 zlib1g:i386'
- fi
- }
- buildinstall() {
- CORECOUNT=$(cat /proc/cpuinfo | grep processor | wc -l)
- CORECOUNT=$(($CORECOUNT + 1))
- if [[ $CORECOUNT < 2 ]]; then
- echo "There has been an error reading the number of processor cores."
- exit;
- else
- echo "The script will have make use of $CORECOUNT threads to speed up the compile operation."
- fi
- echo "Downloading and extracting WINE sources..."
- wget http://mirrors.ibiblio.org/wine/source/1.5/wine-1.5.9.tar.bz2 -O $HOME/wine-1.5.9.tar.bz2
- tar xf "$HOME/wine-1.5.9.tar.bz2" -C "$HOME"
- cd "$HOME/wine-1.5.9" && ./configure --prefix="$HOME"
- echo ""
- echo "!=============================================================================================!"
- echo "If you see any errors or warnings about X11, Freetype or libpng libraries here, complain to me."
- echo "!=============================================================================================!"
- echo ""
- echo "Starting compile. This'll take a while, go have a cuppa :)"
- cd "$HOME/wine-1.5.9" && make "-j$CORECOUNT" >$HOME/wine-1.5.9/makelog.log
- echo ""
- echo "All done compiling! Installing..."
- cd "$HOME/wine-1.5.9" && make install >$HOME/wine-1.5.9/makeinstalllog.log
- echo ""
- echo "Install complete."
- }
- winetricksxact() {
- echo "Installing cabextract to satisfy winetricks dependancy..."
- $(sudoequiv) 'apt-get install cabextract'
- echo ""
- echo "Installing required libraries using winetricks..."
- echo ""
- wget http://winetricks.org/winetricks -O $HOME/winetricks
- chmod +x "$HOME/winetricks"
- "$HOME/winetricks" xact
- echo ""
- echo "Clearing winetricks cache for directx..."
- rm "$HOME/.cache/winetricks/directx9/*"
- }
- xvfbinstall() {
- echo "Installing Xvfb, xdotool and screen..."
- $(sudoequiv) 'apt-get install xvfb xdotool screen'
- }
- createstartscript() {
- if [ -a $HOME/bin/wine ]; then
- WINELOC=$HOME/bin/wine
- elif [-a $HOME/usr/bin/wine ]; then
- WINELOC=$HOME/usr/bin/wine
- elif [-a $HOME/usr/local/bin/wine ]; then
- WINELOC=$HOME/usr/local/bin/wine
- else
- echo "Error detecting WINE path: was make install run globally or even at all?"; exit;
- fi
- echo "#!/bin/bash\\
- screen -S arma2server xvfb-run $WINELOC \"$HOME/.wine/drive_c/arma2oaserver.exe\" $@ &\\
- (sleep 20 && xdotool key Return) &" > $HOME/startserver.sh
- chmod +x $HOME/startserver.sh
- echo "First, edit $HOME/startserver.sh to point to the correct location of your arma2oaserver.exe - it defaults to the wine C drive root."
- echo "To start the server, use startserver.sh in your home directory (you can pass switches through that script like you would for the binary). Be sure to give the application some time to start. You can check it's running with 'ps aux | grep arma2oa'"
- }
- if [ "$USER" == "root" ]; then
- echo "Do not run this script as root. Use the account you wish to use for WINE."; exit;
- fi
- echo "This script will download, compile and install a headless WINE server for use with the Windows ARMA 2 server software."
- echo""
- echo""
- UBUNTU=$(cat /etc/issue | grep Ubuntu)
- DEBIAN=$(cat /etc/issue | grep Debian)
- if [ -n "$DEBIAN" ]; then
- DISTRO="Debian"
- elif [ -n "$UBUNTU" ]; then
- DISTRO="Ubuntu"
- else
- DISTRO=""
- echo "Unsupported distro"
- exit;
- fi
- echo "Your distribution has been detected as $DISTRO, is this correct?"
- select yn in "Yes" "No"; do
- case $yn in
- Yes ) installdeps
- buildinstall
- winetricksxact
- winetricksxact
- xvfbinstall
- createstartscript
- break;;
- No ) exit;;
- esac
- done
- echo ""
- echo "Script has completed, hopefully everything works!"
- echo ""
- exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement