Mini Shell
#!/usr/bin/bash
# Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2021 All Rights Reserved
#
# Licensed under CLOUD LINUX LICENSE AGREEMENT
# http://cloudlinux.com/docs/LICENSE.TXT
# Note: Also called from Debian
# Arguments:
# RPM
# $1 == 1 - install package
# $1 == 2 - upgrade package
# DEB
# $1 == configure - RPM post/posttrans
# "lve-stats POST INSTALL STARTED"
rhel=$2
python_sitelib=$3
python27_sitelib=$4
if [[ "${rhel}" -lt 7 ]]; then
if [[ $1 -eq 1 || $1 == "configure" ]]; then
/sbin/chkconfig --add lvestats
fi
fi
/opt/cloudlinux/venv/bin/python3 /usr/share/lve-stats/utils/import-settings-v1-to-v2.py
if [[ -f /var/lock/subsys/lvestats2-server ]]; then
/sbin/service lvestats stop
fi
# make backup for downgrade support
mkdir -p "${python_sitelib}"/lvestats/utils/dbmigrator-back
\cp --force --recursive "${python_sitelib}"/lvestats/utils/dbmigrator/* "${python_sitelib}"/lvestats/utils/dbmigrator-back
# accumulate migration scripts in dbmigrator/version
\cp -rn "${python_sitelib}"/lvestats/utils/dbmigrator-back/versions/* "${python_sitelib}"/lvestats/utils/dbmigrator/versions/
# LVES-988: fix traceback in postun section of previous installed lve-stats package
if [[ -e "${python27_sitelib}"/lvestats/utils/dbmigrator-back/dbmigrate.py ]]; then
echo 'import sys; sys.exit(0)' > "${python27_sitelib}"/lvestats/utils/dbmigrator-back/dbmigrate.py
fi
/usr/sbin/lve-create-db --update-serverid-auto
if [[ "${rhel}" -gt 6 ]]; then
/usr/bin/systemctl daemon-reload
fi
# "lve-stats POST INSTALL FINISHED"
exit 0
Zerion Mini Shell 1.0