Hacked By AnonymousFox

Current Path : /usr/share/l.v.e-manager/scriptlets/
Upload File :
Current File : //usr/share/l.v.e-manager/scriptlets/rpm_preun.sh

#!/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

# RPM preun script
# Note: Also called from Debian lvemanager.prerm scriptlet
# Arguments:
# RPM
# "$1" == 0 -- RPM will uninstall package
# "$1" == 1 -- RPM upgrade/downgrade package
# DEB
# "$1" == "remove" - DEB will uninstall package
# "$1" == "upgrade" -- DEB upgrade/downgrade package
# Common
# $2 - python binary path - /opt/cloudlinux/venv/bin/python3
# $3 - CL Solo marker - /etc/cloudlinux-edition-solo

# "lvemanager PRE UNINSTALL STARTED"

# RPM/DEB argument unified interpreter
argument=''

if [[ "$1" == 0 || "$1" == "remove" ]]; then
	# "$1" == 0 -- RPM will uninstall package
	# "$1" == "remove" - DEB will uninstall package
	argument='uninstall'
elif [[ "$1" == 1 || "$1" == "upgrade" ]]; then
	# "$1" == 1 -- RPM upgrade/downgrade package
	# "$1" == "upgrade" -- DEB
	argument='upgrade'
else
	# Unknown argument, skip
	exit 0
fi

PYTHON_BIN="$2"
SOLO_MARKER="$3"
CONTAINER_MARKER="$4"

# uninstall
if [[ "$argument" == 'uninstall' ]]; then
    $PYTHON_BIN /usr/share/l.v.e-manager/install-lvemanager-plugin.py -d

    # Temporary disable lve extension removal in non-LVE environment until CLPRO-2013 is finished
    if [[ ! -f "$SOLO_MARKER" && ! -f "$CONTAINER_MARKER" ]]; then
        $PYTHON_BIN /usr/share/l.v.e-manager/cpanel/extension/remove_lve_extension.py
    fi

    if [[ ! -f "$SOLO_MARKER" && ! -f "$CONTAINER_MARKER" ]]; then
        $PYTHON_BIN /usr/share/l.v.e-manager/utils/cache_rubygems.py -d
    fi

    $PYTHON_BIN /usr/share/l.v.e-manager/utils/cache_phpdata.py -d
fi

# upgrade
if [[ "$argument" == 'upgrade' ]]; then
    if [ -f /usr/share/l.v.e-manager/utils/downgrades/clear-resource-usage.py ]; then
        $PYTHON_BIN /usr/share/l.v.e-manager/utils/downgrades/clear-resource-usage.py
    fi
    if [ -f /usr/share/l.v.e-manager/utils/downgrades/migrate-ui-configs.py ]; then
        $PYTHON_BIN /usr/share/l.v.e-manager/utils/downgrades/migrate-ui-configs.py
    fi
fi

# "lvemanager PRE UNINSTALL FINISHED"

Hacked By AnonymousFox1.0, Coded By AnonymousFox