#!/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 # For details see: # 1. https://www.debian.org/doc/debian-policy/ch-maintainerscripts.html#summary-of-ways-maintainer-scripts-are-called # 2. https://www.debian.org/doc/debian-policy/ap-flowcharts.html # Post remove # $1 == remove/purge/upgrade # "lve-stats DEBIAN POSTRM STARTED" solo_marker=/etc/cloudlinux-edition-solo rhel=8 __python=/opt/cloudlinux/venv/bin/python3 python_sitelib="$(/opt/cloudlinux/venv/bin/python3 -c "import sysconfig, sys; sys.stdout.write(sysconfig.get_path('purelib'))")" python27_sitelib=/opt/alt/python27/lib/python2.7/site-packages if [[ -f "${solo_marker}" ]]; then exit 0 fi if [[ "${rhel}" -gt 6 ]]; then /usr/bin/systemctl daemon-reload fi # for support downgrade database to lve-stats <= 2.3 run migration scripts from backup # LVES-987: do not execute migration script while update of lve-stats package from python2 to python3 if [[ -f "${python_sitelib}"/lvestats/utils/dbmigrator-back/dbmigrate.py ]] \ && [[ ! -f "${python_sitelib}"/lvestats/utils/dbmigrator/dbmigrate.py ]] \ && [[ ! -f "${python27_sitelib}"/lvestats/utils/dbmigrator/dbmigrate.py ]]; then ${__python} "${python_sitelib}"/lvestats/utils/dbmigrator-back/dbmigrate.py || true # "|| true" for ignoring exit code fi if [[ $1 -eq 1 || $1 == "upgrade" ]] ; then # clear plugins trash ${__python} "${python_sitelib}"/lvestats/utils/dbmigrator-back/trash_cleaner.py || true fi # "lve-stats DEBIAN POSTRM FINISHED" exit 0