Monday, March 1, 2010

The External Grid Selector script, version 0.3

This new version of the grid selector script no longer detects any third-party viewers, because virtually all major third-party viewers now have a built-in grid manager. The only viewer that does not have it is the official one, including Viewer 2.0. So this version will only detect versions of the official one, including Snowglobe.

Without further ado, here's the script:

========================
#!/usr/bin/env bash

#Second Life Grid Selector and Client Launcher
#A simple grid manager for the official Second Life viewer
#(C) 2010 Jose A. Agudo aka Second Life resident Antonius Misfit
#Licensed under the terms of the GNU General Public License v3 or at your option any later version

viewer=$(zenity --list --title="Viewer Chooser" --text="Choose a viewer:" --column="Viewers" $(find SecondLife*/secondlife Snowglobe*/snowglobe))

#retrieve grid "database" which is simply a bash array variable sourced from a file
if [ -e $HOME/.grids.db ];then
source $HOME/.grids.db
else
cat > $HOME/.grids.db << EOF
#Feel free to add grids here
grids=("Second_Life" https://login.agni.lindenlab.com/cgi-bin/login.cgi "Localhost" http://127.0.0.1:9000 "3rdrock" http://grid.3rdrockgrid.com:8002/ "OSGrid" http://osgrid.org:8002/ "InWorldz" http://71.6.142.199:8002/)
EOF
source $HOME/.grids.db
fi

main()
{
action=$(zenity --list --title="SL Grid Launcher" --text="Choose a grid:" --column="Grids" --column="Login URI" --print-column="2" ${grids[@]:0} "Exit" "Exit")
case $action in
Exit) exit;;
*) $viewer --loginuri=$action;;
esac
}
main

========================

No comments: