#!/bin/bash # # lib/stx-integ # # ``plugin.sh`` calls the entry points in this order: # # - install_integ # - configure_integ # - init_integ # - start_integ # - stop_integ # - cleanup_integ _XTRACE_STX_INTEG=$(set +o | grep xtrace) set -o xtrace # Defaults # -------- STXINTEG_DIR=${GITDIR[$STX_INTEG_NAME]} PLATFORM_UTIL_DIR=$STXINTEG_DIR/utilities/platform-util # STX_INST_DIR should be a non-root-writable place to install build artifacts STX_INST_DIR=${STX_INST_DIR:-/usr/local} STX_BIN_DIR=${STX_BIN_DIR:-$STX_INST_DIR/bin} STX_SBIN_DIR=${STX_SBIN_DIR:-$STX_INST_DIR/sbin} # Set up so we don't use sudo for installs when not necessary STX_SUDO="sudo" [[ -w $STX_INST_DIR ]] && STX_SUDO="env" PYTHON_SITE_DIR=$(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") function cleanup_integ { # Cleanup the service stop_integ } function configure_integ { # Configure the service : } function init_integ { # Initialize and start the service : } function install_integ { # Install the service if is_service_enabled platform-util; then install_platform_util fi } function install_platform_util { pushd $PLATFORM_UTIL_DIR/platform-util sudo python setup.py install \ --root=/ \ --install-lib=$PYTHON_SITE_DIR \ --prefix=/usr \ --install-data=/usr/share \ --single-version-externally-managed popd local systemddir=/etc/systemd $STX_SUDO install -m 755 -d ${STX_SBIN_DIR} $STX_SUDO install -m 755 $PLATFORM_UTIL_DIR/scripts/patch-restart-mtce ${STX_SBIN_DIR} $STX_SUDO install -m 755 $PLATFORM_UTIL_DIR/scripts/patch-restart-processes ${STX_SBIN_DIR} $STX_SUDO install -m 755 $PLATFORM_UTIL_DIR/scripts/patch-restart-haproxy ${STX_SBIN_DIR} $STX_SUDO install -m 755 $PLATFORM_UTIL_DIR/scripts/cgcs_tc_setup.sh ${STX_BIN_DIR} $STX_SUDO install -m 755 $PLATFORM_UTIL_DIR/scripts/remotelogging_tc_setup.sh ${STX_BIN_DIR} $STX_SUDO install -m 755 $PLATFORM_UTIL_DIR/scripts/connectivity_test ${STX_BIN_DIR} # sudo install -m 755 $PLATFORM_UTIL_DIR/scripts/opt-platform.mount ${systemddir}/system # sudo install -m 755 $PLATFORM_UTIL_DIR/scripts/opt-platform.service ${systemddir}/system # sudo install -m 755 $PLATFORM_UTIL_DIR/scripts/memcached.service ${systemddir}/system } function start_integ { # Initialize and start the service : } function stop_integ { # Shut the service down : } $_XTRACE_STX_INTEG