123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226 |
- #!/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="$FFOO_DATA_DIR-local/bash_env"
- FFOO_VERBOSE=true
-
- # 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
-
- 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)"
- popd
- done
- stop_cimserver
- ;;
-
- olmk*)
- # let's build *anything*
- case $2 in
- p|openlmi-providers)
- withjm=0
- rtag_word=$(guess_rtag_word)
- rtag_num=$(guess_rtag_num)
- test "$rtag_word" == "fc" \
- -a 0$rtag_num -ge 22 \
- && withjm=1
- (
- mkdir -p openlmi-providers/build
- cd openlmi-providers/build
- cmake .. -DCMAKE_INSTALL_PREFIX=/usr \
- -DWITH-FAN=0 \
- -DWITH-POWER=0 \
- -DWITH-SSSD=0 \
- -DWITH-JOBMANAGER=$withjm
- make
- make doc
- make install
- make register-Service
- )
- ;;
- t|openlmi-tools)
- (
- cd openlmi-tools
- make clean
- make setup
- python setup.py install
- )
- ;;
- *)
- 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
- popd
- ;;
-
- bkrun)
- pushd "proj/$2"
- make run
- 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 artifacts
- rm -rf $TMP_DIR
- fi
|