loci/scripts/cleanup.sh
Chris Hoge d0ef425ef6 Clean up comment style and identify bugs and workarounds
Cleans up the comment style to remove author names and clarify
the comment as it relates to the code. Using the NOTE (NAME):
format is redundant and takes away attention from the purpose
of documenting why an action is being taken.

Also updates status of TODO and FIXME items, including removing
code was a workaround fixed by a recent patch.

Change-Id: I2e087be1e204c618d1dbe499b3f69eae34ce656f
2018-10-25 11:33:25 -07:00

48 lines
1.3 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|sles)
if [[ "${PYTHON3}" == "no" ]]; then
remove_packages=("python-virtualenv")
else
remove_packages=("python3-virtualenv")
fi
zypper remove -y --clean-deps \
git-core \
patch \
${remove_packages}
zypper clean -a
;;
*)
echo "Unknown distro: ${distro}"
exit 1
;;
esac
# Removing this file allows python to use libraries outside of the
# virtualenv 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.
rm /var/lib/openstack/lib/python*/no-global-site-packages.txt
rm -rf /tmp/* /root/.cache /etc/machine-id
find /usr/ /var/ \( -name "*.pyc" -o -name "__pycache__" \) -delete