Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Gamers & Players
  • Search

HOWTO: Install Unreal Tournament downloaded archives

Having problems getting your favorite Linux game to work? Want to discuss strategies? This is the place!
Post Reply
  • Print view
Advanced search
3 posts • Page 1 of 1
Author
Message
VinzC
Watchman
Watchman
User avatar
Posts: 5100
Joined: Sat Apr 17, 2004 1:51 pm
Location: Dark side of the mood

HOWTO: Install Unreal Tournament downloaded archives

  • Quote

Post by VinzC » Tue Oct 12, 2004 6:48 pm

Hi.

EDIT: here's the first bugfix... I forgot copying to System folder. I also left the Animations folder apart. Changes are commented. Note: the script supports French (frt) and international (int) files. Update to the appropriate language if required.

I don't think this has been published in the forums hence my post. I've been very lazy copying maps, models, skins (aso) I found in files I downloaded for my games.

There are lots of sites where you can download new maps, models and skins for UT2K3/UT2K4. I've downloaded some but I went quite lazy: extract, chmod, chown, copy preserving attributes... I wanted to ease copying these files to an existing installation of Unreal Tournament 2003/2004 without breaking/messing up security, mostly.

I've written my very first bash script to do the following:
- extract files from a Zipped archive into a temporary folder
- apply the same security on files as in UT (owner and mode)
- move extracted files to the game folder
- remove the temporary folder.

Optionnally I also wanted to be able to select either UT2003 or UT2004 with the script. I didn't care much of Unreal Tournament for I already have zillions ( :oops: ) of maps and I'm very happy with it. But the change is not that challenging. Here it is, for those who are interested:

Code: Select all

#!/bin/bash

# Unpack Unreal Tournament downloaded archives to a target directory
# Example: ./unpack -t ut2003 /download/dm-morta.zip
# Arguments:
# archive		source archive
# -t ut2003|ut2004	copy files to either UT2003 or UT2004
# -m zip|bz2|tar	method (default is ZIP)

E_BADDIRECTORY=-1
E_BADMODE=-2
E_ARGMISSING=-3

Mode=zip
Source=/
Target=/

until [ -z "$1" ]
do
	case $1 in
		"-t"  )
			Target=/opt/$2
			shift;;
		"-m"  )
			Mode=$2
			shift;;
		*  ) Source=$1 ;;
	esac
	shift
done

# Check target game directory
if [ $Target != /opt/ut2003 -a $Target != /opt/ut2004  ]; then
	echo "Error: target game must be either 'ut2003' or 'ut2004'" 1>&2
	exit $E_BADDIRECTORY
fi

# Check packing mode
if [ $Mode != "zip" -a $Mode != "bz2" -a $Mode != "tar" ]; then
	echo "Error: archive type must be either 'zip', 'bz2' or 'tar'." 1>&2
	exit $E_BADMODE
fi


# debug: echo "Source archive: $Source, target directory: $Target, mode: $Mode"
# debug: exit 0


# Create a temporary directory and subfolders
# $1: path to temporary folder to create
function CreateTempDir() {
	if [ -z $1 ]; then
		echo "Error: CreateTempDir requires target directory." 1>&2
		exit $E_ARGMISSING
	fi

	mkdir $1
	mkdir $1/System
# BUGFIX (Oct. 18, 2004): Create folder Animations
	mkdir $1/Animations
# BUGFIX
	mkdir $1/Maps
	mkdir $1/Textures
	mkdir $1/KarmaData
	mkdir $1/Music
	mkdir $1/Sounds
	mkdir $1/StaticMeshes
}


# Unzip files
# $1: source archive
# $2: temporary directory for extract
function Unzip() {
	if [ -z $1 ]; then
		echo "Error: Unzip requires source and target directory." 1>&2
		exit $E_ARGMISSING
	fi

	if [ -z $2 ]; then
		echo "Error: Unzip also requires target directory." 1>&2
		exit $E_ARGMISSING
	fi

# BUGFIX (Oct. 18, 2004): Unzip to folder Animations; include *.ucl files in System
# Note: add/change frt to include other language files than (est, itt,...)
	unzip -o -j $1 *.ukx -d $2/Maps 2>/dev/null
	unzip -o -j $1 *.u *.ucl *.upl *.int *.frt -d $2/System 2>/dev/null
# BUGFIX
	unzip -o -j $1 *.ut2 -d $2/Maps 2>/dev/null
	unzip -o -j $1 *.utx -d $2/Textures 2>/dev/null
	unzip -o -j $1 *.ka -d $2/KarmaData 2>/dev/null
	unzip -o -j $1 *.ogg -d $2/Music 2>/dev/null
	unzip -o -j $1 *.uax -d $2/Sounds 2>/dev/null
	unzip -o -j $1 *.usx -d $2/StaticMeshes 2>/dev/null
}


# Set permissions
# $1: temporary directory where files were extracted
function SetPermissions() {
	if [ -z $1 ]; then
		echo "Error: SetPermissions requires target directory." 1>&2
		exit $E_ARGMISSING
	fi

	chown -R root:games $1 2> /dev/null
	chmod -R 640 $1/* 2> /dev/null
	chmod ug+x $1/Music/* 2> /dev/null
}


# Copy files to the final destination, ut2003 or ut2004
# Update only, don't overwrite
# $1: temporary directory where files were extracted
# $2: destination game folder (full path)
function CopyFiles() {
	if [ -z $1 ]; then
		echo "Error: CopyFiles requires source and target directory." 1>&2
		exit $E_ARGMISSING
	fi

	if [ -z $2 ]; then
		echo "Error: CopyFiles also requires target directory." 1>&2
		exit $E_ARGMISSING
	fi

	cp -pu $1/Maps/* $2/Maps 2>/dev/null
	cp -pu $1/Textures/* $2/Textures 2>/dev/null
	cp -pu $1/KarmaData/* $2/KarmaData 2>/dev/null
	cp -pu $1/Music/* $2/Music 2>/dev/null
	cp -pu $1/Sounds/* $2/Sounds 2>/dev/null
	cp -pu $1/StaticMeshes/* $2/StaticMeshes 2>/dev/null
# BUGFIX (Oct. 18, 2004): Copy folders System and Animations
	cp -pu $1/Animations/* $2/Animations 2>/dev/null
	cp -pu $1/System/* $2/System 2>/dev/null
# BUGFIX
}


# Create a temporary directory; pattern /tmp/utmpNNNNN
# where NNNNN is a positive integer:
Number=$RANDOM
TempDir=/tmp/utmp$Number
echo "Creating temp: $TempDir..."
CreateTempDir $TempDir

# Extract files then set permissions
case $Mode in
	 "zip" ) Unzip $Source $TempDir;;
	"*" ) echo "Warning: archive mode $Mode not supported yet.";;
esac

SetPermissions $TempDir
CopyFiles $TempDir $Target

# Remove temporary directory
# debug: ls -lR $TempDir

echo "Removing temporary files..."
rm -r $TempDir
echo "Done."
I'm not the Lord of Bash scripts (like ecatmur ;-) ) so forgive my ignorance where there could have been better coding. There is no support for other types of archives (like tar or bz2) yet for every archive I downloaded till now was ZIP. Again not a big deal for those who love tar :-).

The script works well on Gentoo provided the games are installed in their expected directory, i.e. /opt/ut200?. To use the script, I have created a common directory, e.g. /download, where everybody can write. Little plus: I also modified /etc/skel to contain a symlink to the common download folder, so that every new user can access it from his/her home directory. But it's not required.

Then I run a command shell, su to root and run the script against the archives I just downloaded. The script "recognizes" files in an archive: textures, maps, karma data, sounds, music, meshes and system files. It leaves readmes apart and other text files or screenshots.

It does not change UT200x.ini nor adds the required lines about new characters (serverpackages and player information). It must be done manually. The script could be modified to show the readme (if any) after extract is done... Finally you need unzip on your system for the script to run properly.

Hope this helps.
Last edited by VinzC on Mon Oct 18, 2004 7:17 pm, edited 1 time in total.
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Top
Plastic
l33t
l33t
Posts: 649
Joined: Wed Mar 24, 2004 12:22 am

  • Quote

Post by Plastic » Tue Oct 12, 2004 10:44 pm

Thanks. Very useful.
Top
VinzC
Watchman
Watchman
User avatar
Posts: 5100
Joined: Sat Apr 17, 2004 1:51 pm
Location: Dark side of the mood

  • Quote

Post by VinzC » Wed Oct 13, 2004 11:59 am

Glad I could help :-)
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Top
Post Reply
  • Print view

3 posts • Page 1 of 1

Return to “Gamers & Players”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic