#!/bin/sh # # gaim-autosetup.sh -- generates autologin configuration for GAIM # so that starting GAIM will log user into #puppylinux # # Copyright 2006 Jonathan Marsden # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 , # as published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA IRCHOST='irc.freenode.net' IRCCHANNEL='#puppylinux' IRCPORT=6667 PREFIX='PupUser-' GAIMCONFIGDIR=~/.gaim PROMPT="Enter the IRC Nickname you wish to use" XDIALOGOPTIONS="--stdout --no-buttons --title $0" # Exit if either of the two files we are generating already exists if test -f $GAIMCONFIGDIR/accounts.xml then exit 1 fi if test -f $GAIMCONFIGDIR/blist.xml then exit 2 fi # Generate a semi-random IRC username USERNAME=$PREFIX`(date ;cat /proc/cpuinfo)|md5sum|sed -e's/^\(......\).*$/\1/'` # Prompt for Nick if -v option used if test "$1" = "-v" then NEWNAME=`Xdialog $XDIALOGOPTIONS --inputbox "$PROMPT" 0 0 "$USERNAME"` if test "$?" -eq 0 then USERNAME=`echo $NEWNAME |tr -cd 'A-Za-z0-9[-\`{-}'` # See RFC 2812 2.3.1 fi fi # Create the two config files cat >$GAIMCONFIGDIR/accounts.xml < prpl-irc $USERNAME@$IRCHOST $USERNAME UTF-8 $USERNAME $IRCPORT 1 EOF cat >$GAIMCONFIGDIR/blist.xml < 0 $IRCCHANNEL 1 EOF