#!/bin/sh # Fail on the first failure set -e # # Simple text installer based on makeself and the Windows installer for WoP. # Use this if you don't want to verify a 400 line shell script or use a binary # installer. # # -- undead # # These two are specific to WoP MAKESELF="worldofpadman.run" FILESIZES="576943498" INSTALLDIR="WoP" # The rest of these are extracted from Makeself. # Note: This is not makeself's version. I chdir with tar. UnTAR() { tar -C $1 -$2vf - 2>&1 || { echo Extraction failed. > /dev/tty; kill -15 $$; } } MS_dd() { blocks=`expr $3 / 1024` bytes=`expr $3 % 1024` dd if="$1" ibs=$2 skip=1 obs=1024 conv=sync 2> /dev/null | \ { test $blocks -gt 0 && dd ibs=1024 obs=1024 count=$blocks ; \ test $bytes -gt 0 && dd ibs=1 obs=1024 count=$bytes ; } 2> /dev/null } MS_untar_file() { mkdir -p "$INSTALLDIR"; offset=`head -n 401 "$MAKESELF" | wc -c | tr -d " "` for s in $FILESIZES; do MS_dd "$MAKESELF" $offset $s | eval "gzip -cd" | UnTAR $INSTALLDIR x offset=`expr $offset + $s` done } WoP_install() { cd "$INSTALLDIR"; # Remove the setup files rm -rf -- setup.data setup.sh # Create the extras mkdir XTRAS tar -C XTRAS -xvf readme.tar tar -C XTRAS -xvf extras.tar mv wop.png copyright_*.txt XTRAS/ # Game data (mod pk3s) mkdir wop tar -C wop -xvf wop-data.tar # All the shell scripts are the same. cp -a bin/Linux/x86/WoP . rm -rf -- bin # Extract the right engine(s) archs=`uname -m` case "$archs" in i?86) archs=i386 ;; x86_64) archs="x86_64 i386" ;; ppc64) archs="ppc64 ppc" ;; esac for arch in $archs; do test -r wop-engine.$arch.tar || continue tar -xvf wop-engine.$arch.tar done # Delete installation copies rm -f -- extras.tar readme.tar wop-data.tar wop-engine.i386.tar rm -f -- wop-engine.ppc.tar wop-engine.x86_64.tar # Add to the readme (I don't know German) echo "Use 'WoP' to execute World of Padman. It will setup the environment and use the right executable" >> README } echo "Untarring the installation files"; MS_untar_file; echo "Installing the program"; WoP_install; echo "Done setting up World of Padman"