Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate

Advertising

Miscellany
Friday, February 22nd, 2008 at 11:19:03pm UTC 

  1. #!/bin/bash
  2.  
  3. CURDIR=`pwd`
  4.  
  5. #if [ `id -u` != 0 ]; then
  6. #echo "Script must be run as root, use sudo"
  7. #exit
  8. #fi
  9.  
  10. function installHamachi() {
  11.  
  12. echo "testing for necessary programs"
  13. sudo aptitude install build-essential upx-ucl-beta
  14.  
  15. if [ ! -f "/usr/bin/hamachi" ]; then
  16. echo "hamachi does not seem to be installed"
  17. exit
  18. fi
  19.  
  20. echo "using upx"
  21. cd /usr/bin
  22. sudo upx-ucl-beta -d hamachi
  23.  
  24. echo "should we do post install tasks to install this as a service? (y/n)"
  25. read -e service
  26.  
  27. if [ $service == "n" ]; then
  28.  
  29. exit 0
  30.  
  31. else
  32.  
  33.  
  34. echo "what nickname should this computer use? Default is `hostname`"
  35. read -e compname
  36.  
  37. if [ ! $compname ];then
  38. compname=`hostname`
  39. fi
  40.  
  41. echo "Name will be $compname"
  42.  
  43. echo "What channel name to join?"
  44. read -e channel
  45.  
  46. echo "What is the password for $channel?"
  47. read -e pass
  48.  
  49. if [ ! -d "~/.hamachi" ]; then
  50. /usr/bin/hamachi-init
  51. fi
  52.  
  53. /usr/bin/hamachi start
  54.  
  55. /usr/bin/hamachi login
  56.  
  57. /usr/bin/hamachi set-nick $compname
  58.  
  59. /usr/bin/hamachi join $channel $pass
  60.  
  61. /usr/bin/hamachi go-online $channel &
  62.  
  63. if [ ! -d "/etc/hamachi" ]; then
  64. sudo mkdir /etc/hamachi
  65. sudo cp -Rv ~/.hamachi/* /etc/hamachi/
  66. echo "Created /etc directory"
  67. fi
  68.  
  69. if [ ! -f "/etc/init.d/hamachi" ]; then
  70. sudo cp -v $CURDIR/hamachi.init /etc/init.d/hamachi
  71. echo "hamachi init installed"
  72. sudo chmod +x /etc/init.d/hamachi
  73. sudo update-rc.d hamachi defaults 60
  74. fi
  75.  
  76. echo "Trying out your new configuration... I will first stop then start your new hamachi service."
  77.  
  78. sudo /etc/init.d/hamachi stop
  79. echo "sleeping, please wait"
  80. sleep 5
  81. sudo /etc/init.d/hamachi start
  82.  
  83. fi
  84. }
  85.  
  86. function makeGui() {
  87. echo "would you like to have hamachi-gui compiled?"
  88. read -e gui
  89.  
  90. if [ "$gui" == "y" ];then
  91. sudo aptitude install libgtk2.0-dev automake libglade2-dev
  92. mkdir ./tmp
  93. #cp hamachi-gui-0.7.2.tar.gz tmp/
  94. cd ./tmp
  95. svn co https://hamachi-gui.svn.sourceforge.net/svnroot/hamachi-gui/trunk .
  96. #tar zxvf hamachi-gui-0.7.2.tar.gz
  97. #cd hamachi-gui-0.7.2/
  98. ./autogen.sh
  99. ./configure
  100. make
  101. sudo make install
  102. cd $CURDIR
  103. rm ./tmp -rfv
  104. echo "done"
  105. fi
  106. }
  107.  
  108. function printUsage() {
  109.         echo
  110.         echo "Usage Info:"
  111.         echo "-g OR --gui"; echo "Install hamachi-gui"
  112.         echo "-i OR --install"; echo "Do initial setup of hamachi, you should have installed hamachi and run tuncfg already"
  113.         echo "-v OR --version"; echo "Print version info and exit"
  114.         echo "-h or --help"; echo "Print this help message and exit"
  115.         echo
  116. }
  117.  
  118.  
  119. case "$1" in
  120. "--gui" | "-g" ) makeGui; exit ;;
  121. "--install" | "-i" ) installHamachi; exit ;;
  122. "--help" | "-h" ) printUsage; exit ;;
  123. "--version" | "-v" ) echo "hamachi installer script written by Jer, copyright 2008"; exit;;

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will not expire by default. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right
worth-right