Files
django_installer/uninstall.sh
2018-09-27 21:58:28 -04:00

48 lines
1.4 KiB
Bash
Executable File

################################################################################
# Performs a FULL uninstall #
################################################################################
# source vars
source ./vars
# remove nginx conf
tput setaf 2
echo "Disabling nginx"
tput setaf 9
systemctl stop nginx 1> /dev/null 2> /dev/null
systemctl disable nginx 1> /dev/null 2> /dev/null
rm -f /etc/nginx/conf.d/$projectname.conf
# remove gunicorn
tput setaf 2
echo "Uninstalling gunicorn"
tput setaf 9
systemctl disable gunicorn 1> /dev/null 2> /dev/null
systemctl stop gunicorn 1> /dev/null 2> /dev/null
rm -f /etc/systemd/system/gunicorn.service
# remove project
tput setaf 2
echo "Removing Django project"
tput setaf 9
rm -rf /home/$user/$projectname
# remove python
tput setaf 2
echo "Uninstalling python"
tput setaf 9
rm -rf $pyinstalldir
# remove yum dependencies
tput setaf 2
echo "Uninstalling dependencies"
tput setaf 9
packages=(gcc wget nginx libsqlite3x-devel.x86_64 postgresql-server postgresql-devel postgresql-contrib bzip2-devel zlib-devel libffi-devel openssl-devel policycoreutils-python.x86_64)
for package in ${packages[@]};
do
echo -e "\tRemoving $package"
yum -y erase $package 1>> /dev/null 2>> /dev/null 3>> /dev/null
if [ $? -ne 0 ] ; then
echo -e "\tyum failed to remove $package."
fi
done