is_cimsqwbot.sh 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #!/usr/bin/env bash
  2. # vim: expandtab tabstop=2 shiftwidth=2 softtabstop=2 autoindent:
  3. NEEDS="git qmake make g++"
  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://gitlab.netdome.biz/mihawk/libqwclient.git
  14. INSTALL=1
  15. fi
  16. if [ ! -d "cimsqwbot" ]; then
  17. git clone https://gitlab.netdome.biz/community-messaging-project/qwbot.git
  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. if [ -f "./cimsqwbot" ]; then
  38. LD_LIBRARY_PATH=$LIBPATH ./cimsqwbot &
  39. PID=$!
  40. echo PID $PID
  41. sleep 1
  42. kill $PID
  43. else
  44. echo
  45. echo "It seems there have been problems compiling this thing! The binary ./cimsqwbot is missing."
  46. echo "This is awkward. Probably some dependency was missing or had a wrong version while compilation."
  47. echo "Better go have a chat to the devs at irc://quakenet.org/qwnet"
  48. echo
  49. exit
  50. fi
  51. # cfg file should have been created by the start of cimsqwbot.
  52. fi
  53. # now, lets check the starting script to be executable in cimsqwbot
  54. if [ -f "$STARTSCRIPTNAME" ]; then
  55. chmod u+x "$STARTSCRIPTNAME"
  56. fi
  57. cd "$BOTPATH"
  58. echo
  59. echo "The installation is now ready to run. BUT..."
  60. echo
  61. echo "1. Because you need the original maps, place pak0.pak and pak1.pak of original quake there:"
  62. echo " $BOTPATH/id1"
  63. echo
  64. echo "2. Please know, that you need maps. The bot will start downloading them often, which takes time."
  65. echo " It is advised, you get some maps already and put them in the appropriate gamedir under"
  66. echo " $BOTPATH"
  67. echo " gamedir qw example: $BOTPATH/qw/maps"
  68. echo " gamedir fortress example: $BOTPATH/fortress/maps"
  69. echo
  70. echo "3. Please edit the $CONFIGNAME"
  71. echo " For an overview of configuration options, please see the wiki at:"
  72. echo " http://redmine.b4r.org/projects/cimsqwbot/wiki"
  73. echo
  74. echo "4. Now, it's cool to run:"
  75. echo " cd "$BOTPATH" && ./startcimsqwbot.sh"
  76. echo
  77. echo "Have fun."
  78. echo
  79. else
  80. echo
  81. echo "It seems the directories 'cimsqwbot' and 'libqwclient' already exist."
  82. echo "So, we did nothing. If you want a fresh install, delete these directories, but"
  83. echo "be sure to save your cimsqwbot.cfg - if you have a good one."
  84. echo
  85. echo "Did nothing."
  86. echo
  87. fi