[ut2004] Cache installer

EC zybhjk at verizon.net
Mon Jun 6 18:58:50 EDT 2005

Mon, 06 Jun 2005 20:49:13 +0200 | Thomas Otto <3.1415926535897932384626433832 at gmx.net>
::-And back to arguing which script is "better" :)
::-My script already places the files in their appropriate folders and
::-leaves modfiles (.u) in place (since mods are better not installed this
::-way), without a cache.ini entry the files in the cache dir are invisible
::-to ut2004.
::-     -Thomas

I was starting to work on adding functionality to Spike's script to move the files to the
ut2004 install location and have variable (through command line arguments) cache and
ut2004 dirs.
I got a bit stuck here:
          echo "*** ut2004 directory is not writable with your user"
          echo "*** would you like to enter the root password and"
          echo "*** move the files as root? [y/n]:"
          read tryasroot
          if [ $tryasroot = y ] ; then
???      su -c 'move_files'
            echo "*** cleaning cancelled!"
            return 1
the function to move all the *.uax, *.ut2 etc files is called move_files.  This check is
if the ut2004 install dir is not user-writable- you can optionally enter the root password
and move the files as root.  However, I do not know how to have it su to root, move the
files, and then exit.  su -c 'mv foo...' would work except for that requires the use of
the $ut2004dir variable, which will not be set after an su, yes?
I was thinking I could have it su -c '/path/to/current_script' and have it excecute
itself, but i dont know how to find the current path and file name from inside a script
Any help, or is this just not worth it?

More information about the ut2004 mailing list