is_cimsqwbot.sh 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #!/bin/bash
  2. # vim: expandtab tabstop=2 shiftwidth=2 softtabstop=2 autoindent:
  3. NEEDS="git qmake make"
  4. for p in $NEEDS; do
  5. TEST=$(which $p 2> /dev/null)
  6. if [ ! -f "$TEST" ]; then
  7. echo "Sorry, you don't seem to have '$p' installed."
  8. echo "You need these programs before this script will run: $NEEDS"
  9. exit
  10. fi
  11. done
  12. if [ ! -d "libqwclient" ]; then
  13. git clone https://github.com/buhnemann/libqwclient.git
  14. INSTALL=1
  15. fi
  16. if [ ! -d "cimsqwbot" ]; then
  17. git clone git://b4r.org/cimsqwbot
  18. INSTALL=1
  19. fi
  20. cd cimsqwbot
  21. BOTPATH=$(pwd)
  22. cd ../libqwclient/
  23. LIBPATH=$(pwd)
  24. CONFIGNAME="$BOTPATH/cimsqwbot.cfg"
  25. STARTSCRIPTNAME="$BOTPATH/startcimsqwbot.sh"
  26. if [ "$INSTALL" == "1" ]; then
  27. # is the configuration file missing? then...
  28. if [ ! -f "$CONFIGNAME" ]; then
  29. cd "$LIBPATH"
  30. git pull
  31. qmake
  32. make
  33. cd "$BOTPATH"
  34. git pull
  35. qmake
  36. make
  37. LD_LIBRARY_PATH=$LIBPATH ./cimsqwbot &
  38. PID=$!
  39. echo PID $PID
  40. sleep 1
  41. kill $PID
  42. # cfg file should have been created by the start of cimsqwbot.
  43. fi
  44. # now, lets check the starting script to be executable in cimsqwbot
  45. if [ -f "$STARTSCRIPTNAME" ]; then
  46. chmod u+x "$STARTSCRIPTNAME"
  47. fi
  48. cd "$BOTPATH"
  49. echo
  50. echo "The installation is now ready to run. BUT..."
  51. echo
  52. echo "1. Because you need the original maps, place pak0.pak and pak1.pak of original quake there:"
  53. echo " $BOTPATH/id1"
  54. echo
  55. echo "2. Please know, that you need maps. The bot will start downloading them often, which takes time."
  56. echo " It is advised, you get some maps already and put them in the appropriate gamedir under"
  57. echo " $BOTPATH"
  58. echo " gamedir qw example: $BOTPATH/qw/maps"
  59. echo " gamedir fortress example: $BOTPATH/fortress/maps"
  60. echo
  61. echo "3. Please edit the $CONFIGNAME"
  62. echo " For an overview of configuration options, please see the wiki at:"
  63. echo " http://redmine.b4r.org/projects/cimsqwbot/wiki"
  64. echo
  65. echo "4. Now, it's cool to run:"
  66. echo " cd "$BOTPATH" && ./startcimsqwbot.sh"
  67. echo
  68. echo "Have fun."
  69. echo
  70. else
  71. echo
  72. echo "It seems the directories 'cimsqwbot' and 'libqwclient' already exist."
  73. echo "So, we did nothing. If you want a fresh install, delete these directories, but"
  74. echo "be sure to save your cimsqwbot.cfg - if you have a good one."
  75. echo
  76. echo "Did nothing."
  77. echo
  78. fi