Don't like ads? PRO users don't see any ads ;-)
Guest

operator1

By: a guest on May 7th, 2012  |  syntax: Bash  |  size: 2.96 KB  |  hits: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/sh
  2. #Barry Kauler 2008.
  3. #firstly, JM's code to setup #puppylinux at IRC, then launch pidgin.
  4.  
  5. #########################
  6. # gaim-autosetup.sh -- generates autologin configuration for GAIM
  7. #                      so that starting GAIM will log user into #puppylinux
  8. #
  9. # Copyright 2006 Jonathan Marsden, GNU General Public License version 2
  10. # FSF Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  11. # bugfix bk 2006. Modified for Pidgin 2008.
  12.  
  13. BACKTITLE="Welcome, an account will be created automatically for
  14. you in the #puppylinux channel at irc.freenode.net.
  15. Type the nickname that you would like to be known by.
  16. The entry already in the box has been autogenerated."
  17. IRCHOST='irc.freenode.net'
  18. IRCCHANNEL='#puppylinux'
  19. IRCPORT=6667
  20. PREFIX='PupUser-'
  21. PURPLECONFIGDIR=~/.purple
  22. PROMPT="Enter the IRC Nickname you wish to use,
  23. as unique as possible to avoid conflict
  24. with already-registered names:"
  25.  
  26. # Exit if either of the two files we are generating already exists
  27. [ -f $PURPLECONFIGDIR/accounts.xml ] && exec pidgin $@
  28. [ -f $PURPLECONFIGDIR/blist.xml ] && exec pidgin $@
  29.  
  30. # Generate a semi-random IRC username
  31. USERNAME=$PREFIX`(date ;cat /proc/cpuinfo)|md5sum|sed -e's/^\(......\).*$/\1/'`
  32.  
  33. NEWNAME=`Xdialog --backtitle "$BACKTITLE" --stdout --no-cancel --title "Pidgin startup" --inputbox "$PROMPT" 0 0 "$USERNAME"`
  34.  
  35. [ $? -ne 0 ] && exec pidgin $@
  36. [ "$NEWNAME" = "" ] && exec pidgin $@
  37.  
  38. USERNAME=`echo "$NEWNAME" |tr -cd 'A-Za-z0-9[-\`{-}'` # See RFC 2812 2.3.1
  39.  
  40. # Create the two config files
  41. cat >$PURPLECONFIGDIR/accounts.xml <<EOF
  42. <?xml version='1.0' encoding='UTF-8' ?>
  43.  
  44. <accounts version='1.0'>
  45.  <account>
  46.   <protocol>prpl-irc</protocol>
  47.   <name>$USERNAME@$IRCHOST</name>
  48.   <settings>
  49.    <setting name='username' type='string'>$USERNAME</setting>
  50.    <setting name='encoding' type='string'>UTF-8</setting>
  51.    <setting name='realname' type='string'>$USERNAME</setting>
  52.    <setting name='port' type='int'>$IRCPORT</setting>
  53.   </settings>
  54.   <settings ui='gtk-gaim'>
  55.    <setting name='auto-login' type='bool'>1</setting>
  56.   </settings>
  57.  </account>
  58. </accounts>
  59. EOF
  60.  
  61. cat >$PURPLECONFIGDIR/blist.xml <<EOF
  62. <?xml version='1.0' encoding='UTF-8' ?>
  63.  
  64. <gaim version='1.0'>
  65.         <blist>
  66.                 <group name="Buddies">
  67.                         <setting name="collapsed" type="bool">0</setting>
  68.                         <chat proto="prpl-irc" account="$USERNAME@$IRCHOST">
  69.                                 <component name="channel">$IRCCHANNEL</component>
  70.                                 <component name="password"></component>
  71.                                 <setting name="gtk-autojoin" type="bool">1</setting>
  72.                         </chat>
  73.                 </group>
  74.         </blist>
  75.         <privacy>
  76.                 <account proto="prpl-irc" name="$USERNAME@$IRCHOST" mode="1">
  77.                 </account>
  78.         </privacy>
  79. </gaim>
  80. EOF
  81. ##############################
  82.  
  83. #now run pidgin...
  84. exec `su spot -c pidgin $@`
  85.  
  86. ###END###