Commit 30c6c41b authored by Aral Balkan's avatar Aral Balkan
Browse files

Added checks for previously-installed components (and cleanup).

parent a328d214
......@@ -119,6 +119,51 @@ privateKey=$(sed '/^$/q')
echo -e "Thank you, I have all the information I need to set up the Better web site.\n"
echo -e "Checking for previously-installed components…"
#
# If an installation already exists, remove it.
# (This is to aid in testing the script and should not be relied on for actual server commissioning.)
#
if [ -d /etc/nginx ]; then
# Remove nginx if it exists
echo " * [Cleanup] Removing existing nginx installation…\n"
sudo apt-get purge -y nginx
sudo apt-get autoremove -y --purge nginx
sudo rm -rf /etc/nginx
fi
if hash /etc/letsencrypt/letsencrypt.sh 2>/dev/null; then
# Remove letsencrypt.sh script if it exists.
echo " * [Cleanup] Removing existing letencrypt.sh script.\n"
sudo rm -rf /etc/letsencrypt
fi
if [ -d /home/git ]; then
# Remove git system account.
echo " * [Cleanup] Removing the git system account…\n"
sudo deluser --remove-home git
fi
if [ -d /var/www ]; then
# Remove the www folder we created earlier.
echo " * [Cleanup] Removing the /var/www folder…\n"
sudo rm -rf /var/www
fi
if [ -f /etc/cron.weekly/letsencrypt-auto-renew-certificate.sh ]; then
# Remove the cron task.
echo " * [Cleanup] Removing the cron task…\n"
sudo rm /etc/cron.weekly/letsencrypt-auto-renew-certificate.sh
fi
echo " * Done."
#
# Start the installation.
#
echo -e "Configuring the Better web site…\n"
#
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment