loci/scripts/cleanup.sh
Gage Hugo 6c1f0290d6 Remove python2 workaround in cleanup.sh
This change removes a workaround for python 2 in the cleanup.sh
script. This is part of the effort to remove the python 2
handling in the loci repo.

Change-Id: I7edf860a0b035d91aa9a3f8e2e3af1e71ce61065
2022-04-27 08:22:10 -05:00

43 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
set -ex
case ${distro} in
debian|ubuntu)
apt-get purge -y --auto-remove \
git \
patch \
python3-virtualenv \
virtualenv
rm -rf /var/lib/apt/lists/*
;;
centos)
# We should be removing 'patch' here, but that breaks
# centos as it tries to rip out systemd for some reason
yum -y autoremove \
git \
python-virtualenv \
python3-virtualenv
yum clean all
;;
opensuse|opensuse-leap|opensuse-tumbleweed|sles)
zypper remove -y --clean-deps \
git-core \
patch \
python3-virtualenv
zypper clean -a
;;
*)
echo "Unknown distro: ${distro}"
exit 1
;;
esac
# Changing this option allows python to use libraries outside of the
# virtualenv > 20 if they do not exist inside the venv. This is a requirement
# for using python-rbd which is not pip installable and is only available
# in packaged form.
sed -i 's/\(include-system-site-packages\).*/\1 = true/g' /var/lib/openstack/pyvenv.cfg
rm -rf /tmp/* /root/.cache /etc/machine-id
find /usr/ /var/ \( -name "*.pyc" -o -name "__pycache__" \) -delete