You are an unregistered user, you can register here
Navigation

Information

Site

Donations
If you wish to make a donation you can by clicking the image below.


BeyondUnreal News

 
Go Back   The Unreal Admins Page > Forums > Unreal Admins > Unreal Tournament > UT Server - Linux Specific

Reply
Thread Tools Display Modes
  #1  
Unread 8th March, 2006, 07:33 AM
~V~ ~V~ is offline
Holy Shit!!
 
Join Date: Sep 2004
Posts: 866
Default New linux cache cleaner

I've rewritten this for UT 99 and I am going to start working on a better installer script since the loki installer refuses to install on x86_64.

http://www.unrealize.co.uk/files/linux-ut99cache.tar.gz

Consider this for testing right now. Feedback is helpful. You will need to edit one line in script for your UT install folder.
__________________
http://www.unrealize.co.uk for XConsole, ServerLog, StealthAdmin and other Unreal Tournament mods.

-= F R A G G A L O N I A... R E S U R R E C T I O N! O L D... S K O O L... S N I P E R =- unreal://82.40.94.2

Old skool sniping. Just you, your weapon, and gravity.

Last edited by ~V~ : 29th May, 2010 at 09:36 PM.
Reply With Quote
  #2  
Unread 8th March, 2006, 04:34 PM
spykes spykes is offline
Rampage
 
Join Date: Jun 2004
Posts: 59
Default

Yeah you were just missing some needed quotes as special shell characters needed to be escaped.

Nice script nonetheless, far better then the one I wrote a couple years ago.
Code:
if [ -x "$HOME/.loki/ut/Cache" ] ; then
  cd $HOME/.loki/ut/Cache
  if [ -a "cache.ini" ] ; then
    (cat cache.ini | grep -v Cache | sed -e "s/^/mv\ \"/" -e "s/\=/\.uxx\" \"/" -e "s/\r//" -e "s/$/\"/" - | grep .uxx) &> cache.txt
    sh cache.txt;rm -f cache.txt cache.ini
    echo "*** cache cleaned successfully!"
    echo "*** you may now move the files to their respective locations."
  else
    echo "*** cache.ini does not exist!"
    echo "*** perhaps your cache contains nothing or has already been cleaned."
  fi
else
  echo "*** cannot find ut cache directory!"
  echo "*** maybe your home directory isnt the one containing the ut cache files."
fi
One nice tip for you tho however...
You do realize that all the UT files can be addressed via $HOME/.loki/ut/* right? Such as Maps, System, Textures, Music and Sounds in their own seperate directories. Moving the files to here instead would not require root privledges for people who have UT installed without write permission access, (most people). This also prevents anyone from ever messing up their UT installation as it remains as prestine as ever since nothing is ever going to modify it. This has an advantage over Windows as you never ever have to reinstall if you mess up UT, just clean out the junk causing the problems in $HOME/.loki/ut. Furthermore this also means one does not have to even set a path in the script for the UT install directory.

Easy enough to do.

cachedir=$HOME/.loki/ut/

Then you need some routine to create any directories that might be missing before starting the moving routine:

create_prefpath()
{
path="${cachedir}$1"
if [ ! -d "$path" ]; then
echo "Creating directory $path"
mkdir "$path"
fi
}

create_prefpath System
create_prefpath Cache
create_prefpath Maps
create_prefpath Music
create_prefpath Textures
create_prefpath Sounds

Last edited by spykes : 8th March, 2006 at 04:44 PM.
Reply With Quote
  #3  
Unread 8th March, 2006, 04:44 PM
~V~ ~V~ is offline
Holy Shit!!
 
Join Date: Sep 2004
Posts: 866
Default

The escapes didn't work in gawk, or at least I couldn't find any that did.

I never install anything as root if I can help it, but its quite easy to do as you say and use .loki folder instead of install folder as nothing prevents this.

I deliberately didn't use $HOME in case maybe there is some other type of installation that doesn't use a sub folder of it, but of course it is easy for anyone to change this and put $HOME/.loki/ut/Cache but they would probably need to mkdir the subfolders.
__________________
http://www.unrealize.co.uk for XConsole, ServerLog, StealthAdmin and other Unreal Tournament mods.

-= F R A G G A L O N I A... R E S U R R E C T I O N! O L D... S K O O L... S N I P E R =- unreal://82.40.94.2

Old skool sniping. Just you, your weapon, and gravity.

Last edited by ~V~ : 8th March, 2006 at 04:47 PM.
Reply With Quote
  #4  
Unread 8th March, 2006, 04:47 PM
Rush's Avatar
Rush Rush is offline
Holy Shit!!
 
Join Date: Apr 2003
Location: Poland
Posts: 1,156
Default

Just to remind, Anthrax has made a nice kesh kleenor for Linux, purely in UnrealScript http://utgl.unrealadmin.org/KeshKlee...1.0_beta-1.rar
__________________
[email address]
Reply With Quote
  #5  
Unread 8th March, 2006, 09:51 AM
~V~ ~V~ is offline
Holy Shit!!
 
Join Date: Sep 2004
Posts: 866
Default

Quote:
Originally Posted by Rush
Just to remind, Anthrax has made a nice kesh kleenor for Linux, purely in UnrealScript http://utgl.unrealadmin.org/KeshKlee...1.0_beta-1.rar
Yes but a script has the advantage of running automatically every time you run UT. EG make another script:

#!/bin/bash
utcache
ut
__________________
http://www.unrealize.co.uk for XConsole, ServerLog, StealthAdmin and other Unreal Tournament mods.

-= F R A G G A L O N I A... R E S U R R E C T I O N! O L D... S K O O L... S N I P E R =- unreal://82.40.94.2

Old skool sniping. Just you, your weapon, and gravity.
Reply With Quote
  #6  
Unread 8th March, 2006, 09:55 AM
~V~ ~V~ is offline
Holy Shit!!
 
Join Date: Sep 2004
Posts: 866
Default

Quote:
Originally Posted by spykes
create_prefpath()
{
path="${cachedir}$1"
if [ ! -d "$path" ]; then
echo "Creating directory $path"
mkdir "$path"
fi
}

create_prefpath System
create_prefpath Cache
create_prefpath Maps
create_prefpath Music
create_prefpath Textures
create_prefpath Sounds
Why use a routine in a script when you only have to do this once? Far easier to just make the folders yourself.

Also another reason for not using home folder is that you don't ever have to worry about disk space. I use main UT folder because I installed to a place that I knew there was ample disk space for it.

PS Your script needs some { } or 'mkdir $path' will execute what the outcome of if
__________________
http://www.unrealize.co.uk for XConsole, ServerLog, StealthAdmin and other Unreal Tournament mods.

-= F R A G G A L O N I A... R E S U R R E C T I O N! O L D... S K O O L... S N I P E R =- unreal://82.40.94.2

Old skool sniping. Just you, your weapon, and gravity.

Last edited by ~V~ : 8th March, 2006 at 09:58 AM.
Reply With Quote
  #7  
Unread 8th March, 2006, 10:58 AM
spykes spykes is offline
Rampage
 
Join Date: Jun 2004
Posts: 59
Default

Quote:
Originally Posted by ~V~
Why use a routine in a script when you only have to do this once? Far easier to just make the folders yourself.

Also another reason for not using home folder is that you don't ever have to worry about disk space. I use main UT folder because I installed to a place that I knew there was ample disk space for it.
First off, because some people might not bother and it only actually "creates" the directories if they don't exist in the first place. The "ut" script that sets the paths and runs ut-bin uses the exact same routine.

And second, /home on my system and most others I ever saw is large. It shouldn't be a problem for most people. There is no reason for /usr to be an ungodly size for that matter. Also many people aren't going to have a custom partition/device with alot of space. I have 2 seperately mounted drives myself, but they are strictly for media and backup storage.

I keep everything I want to load with a nice degree of speed on my primary Raptor.

And finally, having a fresh install of UT at all times is a nice compromise for just only storing all your cached files/mods in $HOME. You see people on Windows reinstall UT all the time as soon as something breaks.

Last edited by spykes : 8th March, 2006 at 11:00 AM.
Reply With Quote
  #8  
Unread 8th March, 2006, 11:16 AM
~V~ ~V~ is offline
Holy Shit!!
 
Join Date: Sep 2004
Posts: 866
Default

It is easy enough to change the script path to .loki dir though. I think most linux users would be savvy enough to know how.

But it's true it is probably better to save cached files there. I made a partition just for UT with growth room though , but then I'm a UT freak
__________________
http://www.unrealize.co.uk for XConsole, ServerLog, StealthAdmin and other Unreal Tournament mods.

-= F R A G G A L O N I A... R E S U R R E C T I O N! O L D... S K O O L... S N I P E R =- unreal://82.40.94.2

Old skool sniping. Just you, your weapon, and gravity.
Reply With Quote
  #9  
Unread 8th March, 2006, 11:26 AM
spykes spykes is offline
Rampage
 
Join Date: Jun 2004
Posts: 59
Default

Another nice workaround if you don't want your files in $HOME, then simply make a symbolic link of your $HOME/.loki/ut to somewhere on /mnt/str1/ such as /mnt/str1/uthome or whatnot. Advantages of both worlds then. There's always a way around drive space limitations in Linux when you have more space somewhere else.

I do the same thing with my $HOME/.vmware directory as I don't want a huge 8gb virtual disk of something I rarely use taking up that much precious real estate of my Raptor.

Plus if you ever seen the size of samegames in id softwares doom3 based games you'd understand this will be useful there too.

Last edited by spykes : 8th March, 2006 at 11:31 AM.
Reply With Quote
  #10  
Unread 8th March, 2006, 12:28 PM
~V~ ~V~ is offline
Holy Shit!!
 
Join Date: Sep 2004
Posts: 866
Default

Well as it is it's up to the user to edit where they want the files to go and/or make sym links etc.

So I think I'll leave it at that.

But on another note I had one instance where the script got caught in an infinite loop, although it still moved the files properly. I think I've fixed the problem but I would be grateful for any bug reports.
__________________
http://www.unrealize.co.uk for XConsole, ServerLog, StealthAdmin and other Unreal Tournament mods.

-= F R A G G A L O N I A... R E S U R R E C T I O N! O L D... S K O O L... S N I P E R =- unreal://82.40.94.2

Old skool sniping. Just you, your weapon, and gravity.
Reply With Quote
  #11  
Unread 8th March, 2006, 12:39 PM
spykes spykes is offline
Rampage
 
Join Date: Jun 2004
Posts: 59
Default

I'll check it out.

Although I don't play on public servers anymore (just a private one), I know a few people who use Linux that do.
Reply With Quote
  #12  
Unread 8th March, 2006, 01:02 PM
Rush's Avatar
Rush Rush is offline
Holy Shit!!
 
Join Date: Apr 2003
Location: Poland
Posts: 1,156
Default

Hey you guys running Linux, could you please confirm a bug I submitted on wine-bugs ? It is here -> http://bugs.winehq.org/show_bug.cgi?id=4391
I think that UT runs pretty well on wine, maybe even better than native in some cases, but unfortunately some issues make it unplayable.
__________________
[email address]
Reply With Quote
  #13  
Unread 8th March, 2006, 02:17 PM
~V~ ~V~ is offline
Holy Shit!!
 
Join Date: Sep 2004
Posts: 866
Default

Just edited one line - replaced an exit 0 with a close
Doesn't make a whole lot of difference unless you leave the parts in to delete de.u
__________________
http://www.unrealize.co.uk for XConsole, ServerLog, StealthAdmin and other Unreal Tournament mods.

-= F R A G G A L O N I A... R E S U R R E C T I O N! O L D... S K O O L... S N I P E R =- unreal://82.40.94.2

Old skool sniping. Just you, your weapon, and gravity.
Reply With Quote
  #14  
Unread 8th March, 2006, 02:18 PM
spykes spykes is offline
Rampage
 
Join Date: Jun 2004
Posts: 59
Default

I couldn't say it runs better honestly, its flawless here, if I disable vsync I hit > 200fps and things go wacko due to the outdated ticker code in the game.
Reply With Quote
  #15  
Unread 8th March, 2006, 02:19 PM
~V~ ~V~ is offline
Holy Shit!!
 
Join Date: Sep 2004
Posts: 866
Default

Quote:
Originally Posted by Rush
Hey you guys running Linux, could you please confirm a bug I submitted on wine-bugs ? It is here -> http://bugs.winehq.org/show_bug.cgi?id=4391
I think that UT runs pretty well on wine, maybe even better than native in some cases, but unfortunately some issues make it unplayable.
Only have linux version installed atm although I tested server with wine, it was having lag problems so I gave up on it.

PS: might have been better to start a new thread about that?
__________________
http://www.unrealize.co.uk for XConsole, ServerLog, StealthAdmin and other Unreal Tournament mods.

-= F R A G G A L O N I A... R E S U R R E C T I O N! O L D... S K O O L... S N I P E R =- unreal://82.40.94.2

Old skool sniping. Just you, your weapon, and gravity.
Reply With Quote
  #16  
Unread 8th March, 2006, 03:06 PM
Rush's Avatar
Rush Rush is offline
Holy Shit!!
 
Join Date: Apr 2003
Location: Poland
Posts: 1,156
Default

Quote:
Originally Posted by ~V~
Only have linux version installed atm although I tested server with wine, it was having lag problems so I gave up on it.

PS: might have been better to start a new thread about that?
I tested the server as well and I agree that it sucks running it on wine, but the client doesn't have any problems with lags, everything is smooth, and fps is almost as the native client, but the problem is that as the bug report says something gets wrong after some time ....
PS. I like offtopics And besides it's not a linux client forum, is it ? :> This topic wouldn't match any category.
__________________
[email address]
Reply With Quote
  #17  
Unread 8th March, 2006, 04:04 PM
~V~ ~V~ is offline
Holy Shit!!
 
Join Date: Sep 2004
Posts: 866
Default

I just thought more ppl would see if you made a thread about it
__________________
http://www.unrealize.co.uk for XConsole, ServerLog, StealthAdmin and other Unreal Tournament mods.

-= F R A G G A L O N I A... R E S U R R E C T I O N! O L D... S K O O L... S N I P E R =- unreal://82.40.94.2

Old skool sniping. Just you, your weapon, and gravity.
Reply With Quote
  #18  
Unread 10th March, 2006, 05:40 PM
~V~ ~V~ is offline
Holy Shit!!
 
Join Date: Sep 2004
Posts: 866
Default

*edit: think I've finally nailed the looping bug. Added a few lines

*edit: a small tidy up
__________________
http://www.unrealize.co.uk for XConsole, ServerLog, StealthAdmin and other Unreal Tournament mods.

-= F R A G G A L O N I A... R E S U R R E C T I O N! O L D... S K O O L... S N I P E R =- unreal://82.40.94.2

Old skool sniping. Just you, your weapon, and gravity.

Last edited by ~V~ : 11th March, 2006 at 04:52 AM.
Reply With Quote
  #19  
Unread 15th March, 2006, 12:25 PM
~V~ ~V~ is offline
Holy Shit!!
 
Join Date: Sep 2004
Posts: 866
Default

another small edit. Hopefully cured the looping bug finally ^^
__________________
http://www.unrealize.co.uk for XConsole, ServerLog, StealthAdmin and other Unreal Tournament mods.

-= F R A G G A L O N I A... R E S U R R E C T I O N! O L D... S K O O L... S N I P E R =- unreal://82.40.94.2

Old skool sniping. Just you, your weapon, and gravity.
Reply With Quote
  #20  
Unread 2nd May, 2010, 12:06 PM
Bio-logisch Bio-logisch is offline
Forum Newcomer
 
Join Date: Feb 2006
Posts: 1
Default

Hi, sorry for digging out this old thread, but it still might be interesting for someone else:

I've changed two things in your script:
- I use the variable "$realname" instead of "$line" in the call of the function "moveit", as you already got rid of the DOS - line break character in this variable.
- This allows to use a grep - expression referring to the end of "$realname". That will help with strange filenames, like e. g. "Leeet_.unrEAlMusik.uMx", that might be copied to the wrong directory in your version.

Sure, this will hardly ever happen...

Code:
#!/bin/bash  
function moveit() {
        echo $(mv $cachename$ext $utdir$1$realname 2>/dev/null ) 1>/dev/null 2>&1
        if [ ! -f $utdir$1$realname ]; then echo $realname" move failed!"; echo "";fi
}

function close() {
        rm cache.ini *.uxx 2>/dev/null
#        if [ -f $utdir"System/De.u" ]; then rm $utdir"System/De.u" ;fi # optional
#        if [ -f $utdir"System/de.u" ]; then rm $utdir"System/de.u" ;fi # optional
        exit 0
}

# Need to change these 2 lines:
cachedir=$HOME/.loki/ut/Cache # change to your cache dir
utdir=$HOME/.loki/ut/ # change to your UT dir, or where you want to move files to

# Create directories
for folder in Maps Music Sounds System Textures ; do
if [ -d $utdir$folder ] ; then continue ; else mkdir -v $utdir$folder ; fi
done

ext=".uxx"
cd $cachedir

if [ ! -f cache.ini ]; then close; fi

for line in `cat cache.ini | sed '/^\[Cache\]/d'`
do
realname=${line:33:${#line}-34}
cachename=${line:0:32}
if echo "$realname" | grep -i \.unr$; then moveit "Maps/"
elif echo "$realname" | grep -i \.utx$; then moveit "Textures/"
elif echo "$realname" | grep -i \.uax$; then moveit "Sounds/"
elif echo "$realname" | grep -i \.umx$; then moveit "Music/"
elif echo "$realname" | grep -i \.u$; then moveit "System/"
else continue
fi
Edit:A little correction in the sed - expression:
Ovoids Problems, if "[Cache]" is part of a file name...
"else close" is not a good idea: If there is a file with, let's say the extension "*.dll", you will immediately delete the whole cache. You should stick to the command "continue", which sets the loop to the next round.

Last edited by Bio-logisch : 29th May, 2010 at 03:39 PM.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:10 PM.


 

All pages are copyright The Unreal Admins Page.
You may not copy any pages without our express permission.