From 3d0dfd41c145aed57dd8529a23a53444f284ae73 Mon Sep 17 00:00:00 2001 From: Bryan Pedini Date: Fri, 14 Feb 2020 23:53:20 +0100 Subject: [PATCH] added `uninstall` functionality --- mediawiki.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/mediawiki.sh b/mediawiki.sh index acfc243..0a87c13 100755 --- a/mediawiki.sh +++ b/mediawiki.sh @@ -10,7 +10,7 @@ cat << "EOF" EOF function show_help () { - echo "Usage: $0 [help] " + echo "Usage: $0 [help] " cat << "EOF" Parameters: help: Displays this help message and exits. @@ -23,6 +23,8 @@ function show_help () { full-upgrade: Deletes the servers and their images, maintaining the data, recreates everything from scratch and exits. + uninstall: Deletes the servers and their images, and all the data if necessary and exits. + EOF } @@ -52,6 +54,20 @@ for par in "$@"; do docker-compose up -d exit 0 ;; + "uninstall") + docker-compose down + docker rmi mediawiki:1.34 + read -p "Do you also whish to delete all the data stored in the database (requires sudo permission)? [n]" DELETE_DATA + case "$DELETE_DATA" in + "y" | "Y") + sudo rm -rf data/db/* -v ".gitignore" + ;; + *) + exit 0 + ;; + esac + exit 0 + ;; esac done