#!/bin/bash . <(ffoom init) FFOO_INI_PATH="__FFOO_INI_PATH__" ffoo import core ffoo import ini ffoo import proj_ol ffoo import testing ffoo import sw ffoo import yummy ENVIRON_SCRIPT="$HOME/.eemk-env" FFOO_VERBOSE=true OL_TRY_JM=${OL_TRY_JM:-false} TEST_STATUS=0 # tmp needs to be shared to children if test -d "$TMP_DIR"; then # we must be child THIS_IS_CHILD=true else # we are top parent; need some setup THIS_IS_CHILD=false export TMP_DIR="$(mktemp -d)" fi [ "$(whoami)" == "root" ] || die "you need to be root" yum_install_if_needed wget fc22plus() { test "$(guess_rtag_word)" == "fc" -a 0$(guess_rtag_num) -ge 22 } maybe_with_jobmanager() { debug -v OL_TRY_JM debug -c fc22plus if $OL_TRY_JM || fc22plus; then echo -DWITH-JOBMANAGER=1 else echo -DWITH-JOBMANAGER=0 fi } case "$1" in ## ------ ## ## COMMON ## ## ------ ## abrtbz) think "Updating abrt to internal version" save_repo_for abrtbz yum_update "abrt" ;; sl0) think "Turning off SELinux" setenforce 0 sed -i~ -e 's/^SELINUX=.*/SELINUX=permissive/' /etc/selinux/config ;; ## ------- ## ## OPENLMI ## ## ------- ## ## setup - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ## olbrc) LMI_CIMOM_PORT=5989 mkdir -p "$(dirname $ENVIRON_SCRIPT)" think "Adding ol environment script $ENVIRON_SCRIPT to .bashrc" { # warning: only echo if not login shell or rsync will freak out echo "shopt -q login_shell && echo setting up ol environment variables" echo "export LMI_ACCOUNT_USER='account_test_user'" echo "export LMI_ACCOUNT_GROUP='account_test_group'" echo "export LMI_CIMOM_URL='https://${HOSTNAME}:$LMI_CIMOM_PORT'" echo "export LMI_CIMOM_USERNAME='pegasus'" echo "export LMI_CIMOM_PASSWORD='blank'" echo "export LMI_CIMOM_BROKER='tog-pegasus'" echo "export LMI_RUN_DANGEROUS='1'" echo "export LMI_IND_LISTENER_PORT='15000'" echo "export PYTHONPATH='$PYTHONPATH:$PWD/openlmi-providers/src/python'" } > $ENVIRON_SCRIPT append_if_missing \ "test -f $ENVIRON_SCRIPT && . $ENVIRON_SCRIPT" \ /root/.bashrc ;; olconfig) $0 sl0 think "Bypassing SSL verification" echo "127.0.0.1 $(hostname)" >> /etc/hosts service tog-pegasus start # to generate server.pem service tog-pegasus stop cp "/etc/Pegasus/server.pem" \ "/etc/pki/ca-trust/source/anchors/remote-server.pem" update-ca-trust think "Setting pegasus password" echo "pegasus:blank" | chpasswd $0 olbrc ;; ## runtime - - - - - - - - - - - - - - - - - - - - - - - - - - - - ## olenv) . $ENVIRON_SCRIPT ;; olcs) think "Starting a simple cimserver ($(comment_cimserver))" start_cimserver ;; olrun*) $0 olcs $0 olenv iniread -p mk.run.what.$2 mk-ol.ini \ | while read path; do pushd "$(dirname $path)"; nosetests --nocapture -v "$(basename $path)" es=$? test $es -gt 0$TEST_STATUS && TEST_STATUS=$es popd done stop_cimserver ;; olmk*) # let's build *anything* case $2 in p|openlmi-providers) ( mkdir -p openlmi-providers/build cd openlmi-providers/build cmake .. -DCMAKE_INSTALL_PREFIX=/usr \ -DWITH-FAN=0 \ -DWITH-POWER=0 \ -DWITH-SSSD=0 \ $(maybe_with_jobmanager) make make doc make install make register-Service ) ;; t|openlmi-tools) ( cd openlmi-tools/cli make clean make python setup.py install || die "could not install openlmi-tools" make clean ) ;; *) die "don't know how to build: $2" ;; esac ;; olyum) save_repo_for openlmi-scripts think "Installing OpenLMI software" iniread -s mk.requires.sut mk-ol.ini | any_install think "Installing testing tools" iniread -s mk.requires.test mk-ol.ini | any_install ;; OL) $0 olyum $0 olconfig ;; OLB) think "Installing build dependencies" iniread -s mk.requires.build mk-ol.ini | any_install ;; ## --------- ## ## BEAKERLIB ## ## --------- ## bkrund) TERM=xterm reset pushd "proj/$2" make run > 1 es=$? test $es -gt 0$TEST_STATUS && TEST_STATUS=$es popd ;; bkrun) pushd "proj/$2" make run es=$? test $es -gt 0$TEST_STATUS && TEST_STATUS=$es popd ;; ## rpmwork - - - - - - - - - - - - - - - - - - - - - - - - - - - - ## rpmso) path=rpms/old/`arch` think "Deploying old RPMs from $path" guess_pkgnames $path | yum_preerase yum_install $path/* guess_pkgnames $path | installed_versions ;; rpmsn) path=rpms/new/`arch` think "Deploying new RPMs from $path" guess_pkgnames $path | yum_preerase yum_install $path/* guess_pkgnames $path | installed_versions ;; RH) save_repo_for beakerlib save_repo_for rhpkg save_repo_for beakerlib-redhat think "Installing system under test" iniread -s mk.requires.sut mk-bk.ini | any_install think "Installing testing tools" iniread -s mk.requires.test mk-bk.ini | any_install ;; *) usage_is "TARGET" esac if ! $THIS_IS_CHILD; then collect_artifacts -s artifacts rm -rf $TMP_DIR fi exit $TEST_STATUS