Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- # The MIT License (MIT)
- #
- # Copyright (c) 2013 Thomas Klose
- #
- # Permission is hereby granted, free of charge, to any person obtaining a copy of this software
- # and associated documentation files (the "Software"), to deal in the Software without restriction,
- # including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
- # and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
- # subject to the following conditions:
- # The above copyright notice and this permission notice shall be included in all copies or substantial
- # portions of the Software.
- #
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
- # LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
- # EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
- # THE USE OR OTHER DEALINGS IN THE SOFTWARE
- #
- echo "Welcomme to Bitmessageinstaller"
- echo "if this script stops working properly, please install bitmesaage manually"
- echo "as descibed in https://bitmessage.org/wiki/Compiling_instructions"
- echo " "
- echo "setting up environment"
- BITMESSAGE_GIT="https://github.com/Bitmessage/PyBitmessage"
- EXIT_UNKOWNINSTALLER=1
- EXIT_REQUIREMENTSUNRESSOLVED=2
- EXIT_BITMESSAGEEXECUTEABLENOTFOUND=3
- INSTALLDIR="/home/`id -un`/.bitmessage/"
- PY_EXECUTEABLE="/home/`id -un`/.bitmessage/PyBitmessage/bitmessagemain.py"
- BM_EXECUTEABLE="/usr/local/bin/bitmessage"
- if [ -n $(which sudo) ]
- then
- SWITCHTOROOTCOMMAND="sudo"
- else
- SWITCHTOROOTCOMMAND="su root"
- fi
- echo "discovering requirements ..."
- REQUIREMENTSTOINSTALL=""
- if [ -z $(which python) ]
- then
- REQUIREMENTSTOINSTALL="$REQUIREMENTSTOINSTALL python"
- fi
- if [ -z $(which openssl) ]
- then
- REQUIREMENTSTOINSTALL="$REQUIREMENTSTOINSTALL openssl"
- fi
- if [ -z $(which python-qt4) ]
- then
- REQUIREMENTSTOINSTALL="$REQUIREMENTSTOINSTALL python-qt4"
- fi
- if [ -z $(which git) ]
- then
- REQUIREMENTSTOINSTALL="$REQUIREMENTSTOINSTALL git"
- fi
- if [ -n "$REQUIREMENTSTOINSTALL" ]
- then
- if [ -n $(which apt-get) ]
- then
- INSTALLTOOL="apt-get"
- elif [ -n $(which yum) ]
- then
- INSTALLTOOL="yum"
- else
- echo "couldn't find yum or apt-get, please install 'REQUIREMENTSTOINSTALL' and restart this script"
- exit $EXIT_UNKOWNINSTALLER
- fi
- echo "installing requirements ($REQUIREMENTSTOINSTALL)"
- if [ -n $(which sudo) ]
- then
- sudo $INSTALLTOOL -y --force-yes install $REQUIREMENTSTOINSTALL
- else
- su root -c"$INSTALLTOOL -y install $REQUIREMENTSTOINSTALL"
- fi
- fi
- if [ "`which git openssl python | grep -c /`" != "3" ]
- then
- echo "unable to resolve all requirements, please install '$REQUIREMENTSTOINSTALL' and restart this script"
- exit $EXIT_REQUIREMENTSUNRESSOLVED
- fi
- echo "downloading bitmessage from github"
- mkdir "$INSTALLDIR"
- cd "$INSTALLDIR"
- git clone "$BITMESSAGE_GIT"
- if [ -f "$PY_EXECUTEABLE" ]
- then
- if [ ! -x "$PY_EXECUTEABLE" ]
- then
- chmod u+x "$PY_EXECUTEABLE"
- fi
- else
- echo "Error: Excpected File $PY_EXECUTEABLE does not exist"
- exit $EXIT_BITMESSAGEEXECUTEABLENOTFOUND
- fi
- if [ ! -x "$BM_EXECUTEABLE" ]
- then
- if [ -n $(which sudo) ]
- then
- sudo bash << EOF
- echo "#!/bin/bash" > $BM_EXECUTEABLE
- echo "python ~/.bitmessage/PyBitmessage/bitmessagemain.py" >> $BM_EXECUTEABLE
- chmod a+x "$BM_EXECUTEABLE"
- EOF
- else
- su root -c"bash" << EOF
- echo "#!/bin/bash" > $BM_EXECUTEABLE
- echo "python ~/.bitmessage/PyBitmessage/bitmessagemain.py" >> $BM_EXECUTEABLE
- chmod a+x "$BM_EXECUTEABLE"
- EOF
- fi
- fi
- if [ ! -x "$PY_EXECUTEABLE" ]
- then
- echo "File $PY_EXECUTEABLEยด could not be set as executeable."
- echo "set it executeable to use bitmessage"
- fi
- if [ ! -x "$BM_EXECUTEABLE" ]
- then
- echo "Unable to create $BM_EXECUTEABLE. create it with following contents:"
- echo " "
- echo "#!/bin/bash"
- echo "python ~/.bitmessage/PyBitmessage/bitmessagemain.py"
- echo " "
- echo "and set it as executeable"
- fi
- echo "installation of bitmessage was successfull"
- echo "you can find a userguide at bitmessage.org"
- echo "start Bitmeassege by 'bitmessage' command"
Advertisement
Add Comment
Please, Sign In to add comment