61 lines
1.8 KiB
Bash
61 lines
1.8 KiB
Bash
#!/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
|
|
GITDIR["sw-patch"]=$STX_PATCH_DIR/cgcs-patch
|
|
|
|
# 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 {
|
|
setup_dev_lib "sw-patch"
|
|
|
|
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_update {
|
|
if is_service_enabled sw-patch; then
|
|
install_sw_patch
|
|
fi
|
|
}
|
|
|
|
$_XTRACE_STX_UPDATE
|