Advertising
- Miscellany
- Friday, February 22nd, 2008 at 11:19:03pm UTC
- #!/bin/bash
- CURDIR=`pwd`
- #if [ `id -u` != 0 ]; then
- #echo "Script must be run as root, use sudo"
- #exit
- #fi
- function installHamachi() {
- echo "testing for necessary programs"
- sudo aptitude install build-essential upx-ucl-beta
- if [ ! -f "/usr/bin/hamachi" ]; then
- echo "hamachi does not seem to be installed"
- exit
- fi
- echo "using upx"
- cd /usr/bin
- sudo upx-ucl-beta -d hamachi
- echo "should we do post install tasks to install this as a service? (y/n)"
- read -e service
- if [ $service == "n" ]; then
- exit 0
- else
- echo "what nickname should this computer use? Default is `hostname`"
- read -e compname
- if [ ! $compname ];then
- compname=`hostname`
- fi
- echo "Name will be $compname"
- echo "What channel name to join?"
- read -e channel
- echo "What is the password for $channel?"
- read -e pass
- if [ ! -d "~/.hamachi" ]; then
- /usr/bin/hamachi-init
- fi
- /usr/bin/hamachi start
- /usr/bin/hamachi login
- /usr/bin/hamachi set-nick $compname
- /usr/bin/hamachi join $channel $pass
- /usr/bin/hamachi go-online $channel &
- if [ ! -d "/etc/hamachi" ]; then
- sudo mkdir /etc/hamachi
- sudo cp -Rv ~/.hamachi/* /etc/hamachi/
- echo "Created /etc directory"
- fi
- if [ ! -f "/etc/init.d/hamachi" ]; then
- sudo cp -v $CURDIR/hamachi.init /etc/init.d/hamachi
- echo "hamachi init installed"
- sudo chmod +x /etc/init.d/hamachi
- sudo update-rc.d hamachi defaults 60
- fi
- echo "Trying out your new configuration... I will first stop then start your new hamachi service."
- sudo /etc/init.d/hamachi stop
- echo "sleeping, please wait"
- sleep 5
- sudo /etc/init.d/hamachi start
- fi
- }
- function makeGui() {
- echo "would you like to have hamachi-gui compiled?"
- read -e gui
- if [ "$gui" == "y" ];then
- sudo aptitude install libgtk2.0-dev automake libglade2-dev
- mkdir ./tmp
- #cp hamachi-gui-0.7.2.tar.gz tmp/
- cd ./tmp
- svn co https://hamachi-gui.svn.sourceforge.net/svnroot/hamachi-gui/trunk .
- #tar zxvf hamachi-gui-0.7.2.tar.gz
- #cd hamachi-gui-0.7.2/
- ./autogen.sh
- ./configure
- make
- sudo make install
- cd $CURDIR
- rm ./tmp -rfv
- echo "done"
- fi
- }
- function printUsage() {
- echo
- echo "Usage Info:"
- echo "-g OR --gui"; echo "Install hamachi-gui"
- echo "-i OR --install"; echo "Do initial setup of hamachi, you should have installed hamachi and run tuncfg already"
- echo "-v OR --version"; echo "Print version info and exit"
- echo "-h or --help"; echo "Print this help message and exit"
- echo
- }
- case "$1" in
- "--gui" | "-g" ) makeGui; exit ;;
- "--install" | "-i" ) installHamachi; exit ;;
- "--help" | "-h" ) printUsage; exit ;;
- "--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.
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.