#!/bin/sh # # Original file used to patch ut2003 to 2126. # Modified for this upgrade to 2225.3.001 by dan # # Run the update process with appropriate environment # Function to find the real directory a program resides in. # Feb. 17, 2000 - Sam Lantinga, Loki Entertainment Software product=ut2003 FindPath() { fullpath="`echo $1 | grep /`" if [ "$fullpath" = "" ]; then oIFS="$IFS" IFS=: for path in $PATH do if [ -x "$path/$1" ]; then if [ "$path" = "" ]; then path="." fi fullpath="$path/$1" break fi done IFS="$oIFS" fi if [ "$fullpath" = "" ]; then fullpath="$1" fi # Is the sed/ls magic portable? if [ -L "$fullpath" ]; then #fullpath="`ls -l "$fullpath" | awk '{print $11}'`" fullpath=`ls -l "$fullpath" |sed -e 's/.* -> //' |sed -e 's/\*//'` fi dirname $fullpath } # Return the appropriate architecture string DetectARCH() { status=1 case `uname -m` in i?86) echo "x86" status=0;; *) echo "`uname -m`" status=0;; esac return $status } # Get to the proper run directory cd `FindPath "$0"` # Add our binary path to the execution path bin="bin/`uname -s`/`DetectARCH`" PATH="$bin:$PATH" export PATH # See if we should prompt the user for anything prompt=yes if [ "$1" = "--noprompt" ]; then prompt=no shift fi # # NOTE that this installer is going to keep the official # version number at 2225.3, as I don't want to mess with # minor numbers because I don't kow how that will # affect online play. # # Be nice and verbose if [ "$description" = "" ]; then if [ "$component" != "" ]; then description="$product_name: $component $version Update" else description="$product_name $version Update" fi fi echo "=============================================================" echo "Welcome to the $description" echo "=============================================================" # See if the user wants to apply this patch if tty -s && [ "$prompt" = "yes" ]; then # Show the user the README, if there is one available if [ -f README-2225.3.001 ]; then echo "" echo -n "Would you like to read the README for this update? [Y/n]: " read answer case $answer in [Nn]*) ;; *) more README-2225.3.001 ;; esac fi # Ask if the user really wants to apply the update echo "" echo "=============================================================" echo -n "Would you like to apply this update? [Y/n]: " read answer case $answer in [Nn]*) echo "Update cancelled." exit 0 ;; esac fi # See if we can find out where the product is installed if [ "$installed" = "" -o ! -d "$installed" ]; then for path in /opt /usr/local /usr/games /usr/local/games "$HOME"; do if [ -d "$path/$product" ]; then possible="$path/$product" break fi done installed="$possible" # while [ "$installed" = "" -o ! -d "$installed" ]; do # echo -n "Please enter the installation path: [$possible]: " # read line # if [ "$line" != "" ]; then # possible="$line" # fi # installed="$possible" # done fi echo "" echo "=============================================================" echo "Performing update:" # # This could probably be done with # cp -vr ./ $installed # but I prefer to be absolute about copying. # cp -vr ./Benchmark/* $installed/Benchmark cp -vr ./Help/* $installed/Help cp -vr ./System/* $installed/System cp -vr ./Textures/* $installed/Textures cp -vr ./updater/* $installed/updater cp -vr ./Web/* $installed/Web status=$? if [ "$status" = "0" ]; then echo "" echo "Product updated successfully." fi exit $status