StarlingX Installation/Update/Patching/Backup/Restore
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
update/devstack/lib/update

85 lines
2.5 KiB

#!/bin/bash
#
# lib/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}/starlingx/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