25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

run-bitten.sh 4.5 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. #!/bin/sh
  2. tmpdir="$TMPDIR"
  3. if [ -z "${tmpdir}" ]; then tmpdir="$TEMP"; fi
  4. if [ -z "${tmpdir}" ]; then tmpdir="$TEMPDIR"; fi
  5. if [ -z "${tmpdir}" ]; then tmpdir="$TMP"; fi
  6. if [ -z "${tmpdir}" ]; then tmpdir="/tmp"; fi
  7. conffile="`mktemp -q "${tmpdir}/lol-bitten-XXXXXXXX" 2>/dev/null`"
  8. if [ "${conffile}" = "" ]; then
  9. conffile="`mktemp 2>/dev/null`"
  10. fi
  11. builddir="${tmpdir}/lol-bitten-`whoami`"
  12. url="http://lol.zoy.org/builds"
  13. #
  14. # Utility functions
  15. #
  16. append() {
  17. echo "$*" >> "${conffile}"
  18. }
  19. cleanup() {
  20. rm -f "${conffile}"
  21. rm -rf "${builddir}"
  22. }
  23. bailout() {
  24. cleanup
  25. # Exit gracefully
  26. exit 0
  27. }
  28. trap bailout HUP INT QUIT ABRT KILL ALRM TERM
  29. #
  30. # Check for command line
  31. #
  32. if [ "$#" != 2 ]; then
  33. echo "Usage: $0 <username> <password>"
  34. exit 1
  35. fi
  36. #
  37. # Clean up working directory
  38. #
  39. cleanup
  40. if [ -e "${builddir}" ]; then
  41. echo "Error: cannot get rid of ${builddir}"
  42. exit 1
  43. fi
  44. #
  45. # Operating system information
  46. #
  47. append "[os]"
  48. append "name = `uname -srmo 2>/dev/null || uname -srm`"
  49. append "version = 0"
  50. family="`uname -s | tr A-Z a-z`"
  51. case "$family" in
  52. mingw*) family="windows" ;;
  53. darwin*) family="osx" ;;
  54. esac
  55. append "family = $family"
  56. # This random token prevents HTTP conflicts when several instances
  57. # are run from the same machine.
  58. append "token = $$$RANDOM"
  59. append ""
  60. #
  61. # Hardware information
  62. #
  63. append "[machine]"
  64. name="`uname -n | tr A-Z a-z | sed 's/[.].*//'`"
  65. case "$name" in
  66. d*e*s*o*v*) name="putois" ;;
  67. esac
  68. append "name = $name"
  69. processor="`uname -m`"
  70. case "$processor" in
  71. x86_64) processor="amd64" ;;
  72. i*86) processor="i386" ;;
  73. esac
  74. # Windows defines a lot of crazy shit, try to make sense of it
  75. case "$PROCESSOR_ARCHITECTURE" in
  76. amd64|AMD64) processor="amd64" ;;
  77. x86|X86) processor="i386" ;;
  78. esac
  79. case "$PROCESSOR_ARCHITEW6432" in
  80. amd64|AMD64) processor="amd64" ;;
  81. x86|X86) processor="i386" ;;
  82. esac
  83. append "processor = $processor"
  84. append ""
  85. #
  86. # Authentication information
  87. #
  88. append "[authentication]"
  89. append "username = $1"
  90. append "password = $2"
  91. append ""
  92. #
  93. # Visual Studio configuration
  94. #
  95. # FIXME: we also need to check for the Visual Studio SDK
  96. append "[msvc]"
  97. if [ -n "$VS100COMNTOOLS" ]; then
  98. append "version = 10"
  99. elif [ -n "$VS110COMNTOOLS" ]; then
  100. append "version = 11"
  101. elif [ -n "$VS90COMNTOOLS" ]; then
  102. append "version = 9"
  103. fi
  104. append ""
  105. #
  106. # Xbox development kit
  107. #
  108. append "[xdk]"
  109. if [ -n "$XEDK" ]; then
  110. # FIXME: we don't know how to check the version
  111. append "version = 2.0.20675.0"
  112. fi
  113. append ""
  114. #
  115. # PS3 development kit
  116. #
  117. append "[ps3sdk]"
  118. # Try to "detect" the SNC compiler on Windows
  119. if [ -n "$SN_PS3_PATH" ]; then
  120. append "version = 410"
  121. fi
  122. # The setup is easier to detect on Linux
  123. if [ -f "$CELLSDK/version-SDK" ]; then
  124. append "version = $(cat "$CELLSDK/version-SDK")"
  125. fi
  126. append ""
  127. #
  128. # mingw32 / mingw-w64
  129. #
  130. append "[mingw64]"
  131. if x86_64-w64-mingw32-g++ --version >/dev/null 2>&1; then
  132. append "version = $(x86_64-w64-mingw32-g++ --version | sed -ne 's/.*g++ *([^)]*) *//p')"
  133. fi
  134. append ""
  135. append "[mingw32]"
  136. if i686-w64-mingw32-g++ --version >/dev/null 2>&1; then
  137. append "version = $(i686-w64-mingw32-g++ --version | sed -ne 's/.*g++ *([^)]*) *//p')"
  138. fi
  139. append ""
  140. #
  141. # Android NDK
  142. #
  143. append "[ndk]"
  144. if [ "$family" != "windows" ]; then
  145. if [ -f "$ANDROID_NDK_ROOT/RELEASE.TXT" ]; then
  146. append "version = $(cat "$ANDROID_NDK_ROOT/RELEASE.TXT")"
  147. fi
  148. fi
  149. append ""
  150. #
  151. # Google NaCl SDK
  152. #
  153. append "[pepper]"
  154. if [ "$family" != "windows" ]; then
  155. if [ -d "$NACL_SDK_ROOT" ]; then
  156. pepper_version=0
  157. for dir in "$NACL_SDK_ROOT/pepper_"*; do
  158. new_version="$(echo "$dir" | sed 's/.*_//')"
  159. if [ "$new_version" -gt "$pepper_version" ]; then
  160. pepper_version="$new_version"
  161. fi
  162. done
  163. if [ "$pepper_version" != 0 ]; then
  164. append "version = $pepper_version"
  165. fi
  166. fi
  167. fi
  168. append ""
  169. #
  170. # Raspberry Pi cross-compiler
  171. #
  172. append "[raspi]"
  173. if [ "$family" != "windows" ]; then
  174. if [ -d "$RASPI_SDK_ROOT/tools" ]; then
  175. append "version = 0"
  176. fi
  177. fi
  178. append ""
  179. #
  180. # Show what we just did here
  181. #
  182. cat "${conffile}"
  183. #
  184. # Fix system
  185. #
  186. if [ "$family" = "osx" ]; then
  187. # The version of Subversion shipped by Apple is antique; try to
  188. # use the one in /usr/local/bin instead.
  189. PATH="/usr/local/bin:$PATH"
  190. export PATH
  191. fi
  192. #
  193. # Launch everything
  194. #
  195. while : ; do
  196. bitten-slave "$url" \
  197. -f "${conffile}" \
  198. --name "$name" \
  199. --work-dir="${builddir}"
  200. rm -rf "${builddir}"
  201. sleep 10
  202. done
  203. bailout