I dunno if it's worthy of being on the projects page as it's just a terminal script, but let me fiddle with it some more and see if I can make something a bit nicer
EDIT:
Now in GUI flavour! Requires Zenity, but can still be run without. (It will tell you if it can't find Zenity and exit.)
#!/bin/bash
### KD197's Quick UrT Demo Loader ###
### Requires sed, tr and Zenity ###
### Now in GUI flavour! ###
OS=$(uname -s)
URT() {
if [[ $OS == "Linux" ]]; then
### Uncomment out the following line if you use cpufrequtils ###
### and wish to set your cpu mode to "performance". ###
#sudo cpufreq-set -r -g performance
### Start UrT in a second X session ###
DISPLAY=:1.0
xinit /usr/bin/urbanterror $* -- :1
else
### Run Urban Terror on a Mac ###
/Applications/UrbanTerror/ioUrbanTerror.app/Contents/MacOS/ioUrbanTerror.ub $*
fi
}
### Define Colours ###
NC="\x1b[0;32m"
DC="\x1b[0m"
WC="\x1b[0;31m"
### GETOPTS ###
while getopts ":w:n:h" OPTION
do
case $OPTION in
w) FLAG="w" INFILE=$OPTARG;;
n) FLAG="n" INFILE=$OPTARG;;
h) FLAG="h";;
esac
done
### Set paths ###
### Change the ".urbanterror/q3ut4/demos/" part to whatever your path is ###
DIR="$HOME/.urbanterror/q3ut4/demos/"
COM='+set com_cameramode 1 +demo'
WCOM='+set com_cameramode 1 +set r_shownormals 1 +demo'
### Main ###
### Display help ###
if [[ $FLAG == "h" ]]; then
echo -e "${NC}Options: -h${DC} to show this help"
echo -e " ${NC}-u${DC} /path/to/demo.dm_68 to start normally"
echo -e " ${NC}-w${DC} /path/to/demo.dm_68 to start with r_shownormals 1"
echo ""
echo "If no option is passed, graphical mode will be used."
echo "By default, demos are run with com_cameramode 1 so that the"
echo "keyboard may be used, for timescale binds etc; files are moved"
echo "to the demos folder, and the filename is converted to UPPERCASE"
echo "because the Linux version doesn't like the demos otherwise :P"
### Run with r_shownormals ###
elif [[ $FLAG == "w" ]]; then
FILE="$(echo $INFILE | sed 's/.*\/\(.*\.dm_68\)/\1/' | tr [:lower:] [:upper:] | sed 's/DM_68$/dm_68/')"
mv $INFILE ${DIR}${FILE}
URT $WCOM $FILE
### Run normally ###
elif [[ $FLAG == "n" ]]; then
FILE="$(echo $INFILE | sed 's/.*\/\(.*\.dm_68\)/\1/' | tr [:lower:] [:upper:] | sed 's/DM_68$/dm_68/')"
mv $INFILE ${DIR}${FILE}
URT $COM $FILE
### Run with Zenity GUI ##
else
ZFILE=$(zenity --title="Select a demo" --file-selection 2>/dev/null) \
|| { echo -e "${WC}*** Zenity was not found or the operation was cancelled! ***${DC}"; \
echo "If opening a file failed, either install Zenity or run with";
echo "the -h switch to see available options for CLI usage."; exit 1; }
FILE="$(echo $ZFILE | sed 's/.*\/\(.*\.dm_68\)/\1/' | tr [:lower:] [:upper:] | sed 's/DM_68$/dm_68/')"
mv $ZFILE ${DIR}${FILE}
zenity --title="Use r_shownormals?" --question --text "Use r_shownormals?"
if [[ $? == "0" ]]; then
URT $WCOM $FILE
else
URT $COM $FILE
fi
fi
94 Dependancies
cd /opt/local/bin/portslocation/dports/zenity
sudo port install zenity (use this if you actually have macports otherwise you fail lol)
Password: (password here if you have one if not this fails)
---> Computing dependencies for zenity
---> Dependencies to be installed: gtk2 atk gettext expat libiconv gperf ncurses ncursesw glib2 autoconf help2man p5-locale-gettext perl5 perl5.8 m4 automake dbus libtool pkgconfig zlib gtk-doc docbook-xml docbook-xml-4.1.2 xmlcatmgr docbook-xml-4.2 docbook-xml-4.3 docbook-xml-4.4 docbook-xml-4.5 docbook-xml-5.0 docbook-xsl gnome-doc-utils intltool gnome-common p5-getopt-long p5-pathtools p5-scalar-list-utils p5-xml-parser iso-codes libxslt libxml2 py26-libxml2 python26 bzip2 db46 gdbm openssl readline sqlite3 rarian getopt gdk-pixbuf2 jasper jpeg libpng tiff pango Xft2 fontconfig freetype xrender xorg-libX11 xorg-bigreqsproto xorg-inputproto xorg-kbproto xorg-libXau xorg-xproto xorg-libXdmcp xorg-libxcb xorg-libpthread-stubs xorg-xcb-proto xorg-util-macros xorg-xcmiscproto xorg-xextproto xorg-xf86bigfontproto xorg-xtrans xorg-renderproto cairo libpixman shared-mime-info xorg-libXcomposite xorg-compositeproto xorg-libXext xorg-libXfixes xorg-fixesproto xorg-libXcursor xorg-libXdamage xorg-damageproto xorg-libXi xorg-libXinerama xorg-xineramaproto xorg-libXrandr xorg-randrproto libnotify dbus-glib
The log is 30, 000 characters +
so i could put the log here :S
The log is located in a textfile below to show you what i had to go through just to install zenity, You can decide from this if its actually worth installing zenity to run Kd's Demo loader or not, I obviously thought it was worth it otherwise i wouldnt have gone through the hassle lol.