Mini Shell

Direktori : /usr/share/cagefs/scriptlets/
Upload File :
Current File : //usr/share/cagefs/scriptlets/rpm_preun.sh

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

# RPM:
# $1 == 1 -- upgrade
# $1 == 0 -- uninstall

# DEB:
# $1 == remove/upgrade

rhel=$2

if [[ $1 == 0 || $1 == "remove" ]]; then
  /usr/sbin/cagefsctl --hook-remove


  if [[ "${rhel}" > 6 ]]; then
    systemctl --no-reload disable cagefs.service > /dev/null 2>&1
    systemctl stop cagefs.service > /dev/null 2>&1
    systemctl --no-reload disable proxyexecd.service > /dev/null 2>&1
    systemctl stop proxyexecd.service > /dev/null 2>&1
  else
    /sbin/service cagefs stop >/dev/null 2>&1 || :
    /sbin/chkconfig --del cagefs
    /sbin/service proxyexecd stop > /dev/null 2>&1
    /sbin/chkconfig --del proxyexecd
  fi

  # remove /usr/share/cagefs-skeleton/dev/log from syslog config and restart syslog
  /usr/share/cagefs-plugins/install-cagefs-plugin.py --remove-syslog-socket

  # do actions for uninstalling cagefs package
  /usr/share/cagefs-plugins/install-cagefs-plugin.py --uninstall

  #LIBLVE-20
  UPDATES='/etc/sysconfig/lve_updates'
  sed -i -e '/LIBLVE20/d' "$UPDATES" > /dev/null 2>&1

  /usr/sbin/cagefsctl --do-not-ask --remove-all
fi


# uninstall cronjob
rm -f /etc/cron.daily/cagefs.cron

#unmount skeleton
#cagefsctl --unmount-skel

# cagefs 3.0 is NOT installed yet (old version of cagefs is installed) ?
if [ ! -e /etc/cagefs/etc.safe ]; then
    echo "Unmounting users..."
    /usr/sbin/cagefsctl --unmount-all
fi

#uninstall plugin if exists
if [[ $1 == 0 || $1 == "remove" ]];then
    if [ -e "/usr/share/cagefs-plugins/install-cagefs-plugin.py" ];then
        /usr/share/cagefs-plugins/install-cagefs-plugin.py --delete
    fi
    if [ -e "/usr/local/lsws/conf/httpd_config.xml" ]; then
        /sbin/service lsws restart
    fi
fi

exit 0

Zerion Mini Shell 1.0