eemk.in 6.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. #!/bin/bash
  2. . <(ffoom init)
  3. FFOO_INI_PATH="__FFOO_INI_PATH__"
  4. ffoo import core
  5. ffoo import ini
  6. ffoo import proj_ol
  7. ffoo import testing
  8. ffoo import sw
  9. ffoo import yummy
  10. ENVIRON_SCRIPT="$HOME/.eemk-env"
  11. FFOO_VERBOSE=true
  12. TEST_STATUS=0
  13. # tmp needs to be shared to children
  14. if test -d "$TMP_DIR";
  15. then # we must be child
  16. THIS_IS_CHILD=true
  17. else # we are top parent; need some setup
  18. THIS_IS_CHILD=false
  19. export TMP_DIR="$(mktemp -d)"
  20. fi
  21. [ "$(whoami)" == "root" ] || die "you need to be root"
  22. yum_install_if_needed wget
  23. case "$1" in
  24. ## ------ ##
  25. ## COMMON ##
  26. ## ------ ##
  27. abrtbz)
  28. think "Updating abrt to internal version"
  29. save_repo_for abrtbz
  30. yum_update "abrt"
  31. ;;
  32. sl0)
  33. think "Turning off SELinux"
  34. setenforce 0
  35. sed -i~ -e 's/^SELINUX=.*/SELINUX=permissive/' /etc/selinux/config
  36. ;;
  37. ## ------- ##
  38. ## OPENLMI ##
  39. ## ------- ##
  40. ## setup - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ##
  41. olbrc)
  42. LMI_CIMOM_PORT=5989
  43. mkdir -p "$(dirname $ENVIRON_SCRIPT)"
  44. think "Adding ol environment script $ENVIRON_SCRIPT to .bashrc"
  45. {
  46. # warning: only echo if not login shell or rsync will freak out
  47. echo "shopt -q login_shell && echo setting up ol environment variables"
  48. echo "export LMI_ACCOUNT_USER='account_test_user'"
  49. echo "export LMI_ACCOUNT_GROUP='account_test_group'"
  50. echo "export LMI_CIMOM_URL='https://${HOSTNAME}:$LMI_CIMOM_PORT'"
  51. echo "export LMI_CIMOM_USERNAME='pegasus'"
  52. echo "export LMI_CIMOM_PASSWORD='blank'"
  53. echo "export LMI_CIMOM_BROKER='tog-pegasus'"
  54. echo "export LMI_RUN_DANGEROUS='1'"
  55. echo "export LMI_IND_LISTENER_PORT='15000'"
  56. echo "export PYTHONPATH='$PYTHONPATH:$PWD/openlmi-providers/src/python'"
  57. } > $ENVIRON_SCRIPT
  58. append_if_missing \
  59. "test -f $ENVIRON_SCRIPT && . $ENVIRON_SCRIPT" \
  60. /root/.bashrc
  61. ;;
  62. olconfig)
  63. $0 sl0
  64. think "Bypassing SSL verification"
  65. echo "127.0.0.1 $(hostname)" >> /etc/hosts
  66. service tog-pegasus start # to generate server.pem
  67. service tog-pegasus stop
  68. cp "/etc/Pegasus/server.pem" \
  69. "/etc/pki/ca-trust/source/anchors/remote-server.pem"
  70. update-ca-trust
  71. think "Setting pegasus password"
  72. echo "pegasus:blank" | chpasswd
  73. $0 olbrc
  74. ;;
  75. ## runtime - - - - - - - - - - - - - - - - - - - - - - - - - - - - ##
  76. olenv)
  77. . $ENVIRON_SCRIPT
  78. ;;
  79. olcs)
  80. think "Starting a simple cimserver ($(comment_cimserver))"
  81. start_cimserver
  82. ;;
  83. olrun*)
  84. $0 olcs
  85. $0 olenv
  86. iniread -p mk.run.what.$2 mk-ol.ini \
  87. | while read path;
  88. do
  89. pushd "$(dirname $path)";
  90. nosetests --nocapture -v "$(basename $path)"
  91. es=$?
  92. test $es -gt 0$TEST_STATUS && TEST_STATUS=$es
  93. popd
  94. done
  95. stop_cimserver
  96. ;;
  97. olmk*)
  98. # let's build *anything*
  99. case $2 in
  100. p|openlmi-providers)
  101. withjm=0
  102. rtag_word=$(guess_rtag_word)
  103. rtag_num=$(guess_rtag_num)
  104. test "$rtag_word" == "fc" \
  105. -a 0$rtag_num -ge 22 \
  106. && withjm=1
  107. (
  108. mkdir -p openlmi-providers/build
  109. cd openlmi-providers/build
  110. cmake .. -DCMAKE_INSTALL_PREFIX=/usr \
  111. -DWITH-FAN=0 \
  112. -DWITH-POWER=0 \
  113. -DWITH-SSSD=0 \
  114. -DWITH-JOBMANAGER=$withjm
  115. make
  116. make doc
  117. make install
  118. make register-Service
  119. )
  120. ;;
  121. t|openlmi-tools)
  122. (
  123. cd openlmi-tools
  124. make clean
  125. make setup
  126. python setup.py install
  127. )
  128. ;;
  129. *)
  130. die "don't know how to build: $2"
  131. ;;
  132. esac
  133. ;;
  134. olyum)
  135. save_repo_for openlmi-scripts
  136. think "Installing OpenLMI software"
  137. iniread -s mk.requires.sut mk-ol.ini | any_install
  138. think "Installing testing tools"
  139. iniread -s mk.requires.test mk-ol.ini | any_install
  140. ;;
  141. OL)
  142. $0 olyum
  143. $0 olconfig
  144. ;;
  145. OLB)
  146. think "Installing build dependencies"
  147. iniread -s mk.requires.build mk-ol.ini | any_install
  148. ;;
  149. ## --------- ##
  150. ## BEAKERLIB ##
  151. ## --------- ##
  152. bkrund)
  153. TERM=xterm reset
  154. pushd "proj/$2"
  155. make run > 1
  156. es=$?
  157. test $es -gt 0$TEST_STATUS && TEST_STATUS=$es
  158. popd
  159. ;;
  160. bkrun)
  161. pushd "proj/$2"
  162. make run
  163. es=$?
  164. test $es -gt 0$TEST_STATUS && TEST_STATUS=$es
  165. popd
  166. ;;
  167. ## rpmwork - - - - - - - - - - - - - - - - - - - - - - - - - - - - ##
  168. rpmso)
  169. path=rpms/old/`arch`
  170. think "Deploying old RPMs from $path"
  171. guess_pkgnames $path | yum_preerase
  172. yum_install $path/*
  173. guess_pkgnames $path | installed_versions
  174. ;;
  175. rpmsn)
  176. path=rpms/new/`arch`
  177. think "Deploying new RPMs from $path"
  178. guess_pkgnames $path | yum_preerase
  179. yum_install $path/*
  180. guess_pkgnames $path | installed_versions
  181. ;;
  182. RH)
  183. save_repo_for beakerlib
  184. save_repo_for rhpkg
  185. save_repo_for beakerlib-redhat
  186. think "Installing system under test"
  187. iniread -s mk.requires.sut mk-bk.ini | any_install
  188. think "Installing testing tools"
  189. iniread -s mk.requires.test mk-bk.ini | any_install
  190. ;;
  191. *)
  192. usage_is "TARGET"
  193. esac
  194. if ! $THIS_IS_CHILD;
  195. then
  196. collect_artifacts artifacts
  197. rm -rf $TMP_DIR
  198. fi
  199. exit $TEST_STATUS