fec4ac9302
Put everything in /usr/local and allow that to be overridden to a user-writable dir and not require sudo. Also set the stx-devstack-update job voting, at this time it only runs on devstack/* changes. Change-Id: If68ff63585690c7f6c17174797723fb6d43d4473 Signed-off-by: Dean Troyer <dtroyer@gmail.com>
86 lines
2.5 KiB
Bash
86 lines
2.5 KiB
Bash
#!/bin/bash
|
|
#
|
|
# lib/stx-update
|
|
|
|
# ``stack.sh`` calls the entry points in this order:
|
|
#
|
|
# - install_update
|
|
# - configure_update
|
|
# - init_update
|
|
# - start_update
|
|
# - stop_update
|
|
# - cleanup_update
|
|
|
|
_XTRACE_STX_UPDATE=$(set +o | grep xtrace)
|
|
set -o xtrace
|
|
|
|
|
|
# Defaults
|
|
# --------
|
|
|
|
STXUPDATE_REPO=${STXUPDATE_REPO:-${GIT_BASE}/openstack/stx-update.git}
|
|
STXUPDATE_DIR=${GITDIR[$STX_UPDATE_NAME]}
|
|
|
|
STX_PATCH_DIR=$STXUPDATE_DIR/cgcs-patch/
|
|
TSCONFIG_DIR=$STXUPDATE_DIR/tsconfig/
|
|
|
|
# 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 install_sw_patch {
|
|
pushd $STX_PATCH_DIR/cgcs-patch
|
|
sudo python setup.py install \
|
|
--root=/ \
|
|
--install-lib=$PYTHON_SITE_DIR \
|
|
--prefix=/usr \
|
|
--install-data=/usr/share \
|
|
--single-version-externally-managed
|
|
popd
|
|
|
|
local stx_patch_sbindir=$STX_SBIN_DIR
|
|
local stx_patch_sysconfdir=/etc/
|
|
$STX_SUDO install -m 755 -d ${stx_patch_sbindir}
|
|
$STX_SUDO install -m 755 -d ${stx_patch_sysconfdir}/bash_completion.d
|
|
$STX_SUDO install -m 755 -d ${stx_patch_sysconfdir}/goenabled.d
|
|
$STX_SUDO install -m 755 -d ${stx_patch_sysconfdir}/init.d
|
|
$STX_SUDO install -m 755 -d ${stx_patch_sysconfdir}/logrotate.d
|
|
$STX_SUDO install -m 755 -d ${stx_patch_sysconfdir}/patching
|
|
$STX_SUDO install -m 755 -d ${stx_patch_sysconfdir}/patching/patch-scripts
|
|
$STX_SUDO install -m 755 -d ${stx_patch_sysconfdir}/pmon.d
|
|
$STX_SUDO install -m 500 $STX_PATCH_DIR/bin/sw-patch-agent ${stx_patch_sbindir}/sw-patch-agent
|
|
}
|
|
|
|
function install_tsconfig {
|
|
# no setup.cfg in tsconfig, so we can not use pip install -e
|
|
# setup_dev_lib "tsconfig"
|
|
pushd $TSCONFIG_DIR/tsconfig
|
|
sudo python setup.py install \
|
|
--root=/ \
|
|
--install-lib=$PYTHON_SITE_DIR \
|
|
--prefix=/usr \
|
|
--install-data=/usr/share \
|
|
--single-version-externally-managed
|
|
popd
|
|
$STX_SUDO install -d -m 755 $STX_BIN_DIR
|
|
$STX_SUDO install -p -D -m 700 $TSCONFIG_DIR/scripts/tsconfig $STX_BIN_DIR/tsconfig
|
|
}
|
|
|
|
function install_update {
|
|
if is_service_enabled sw-patch; then
|
|
install_sw_patch
|
|
fi
|
|
if is_service_enabled tsconfig; then
|
|
install_tsconfig
|
|
fi
|
|
}
|
|
|
|
$_XTRACE_STX_UPDATE
|