added `uninstall` functionality

This commit is contained in:
Bryan Joshua Pedini 2020-02-14 23:53:20 +01:00
parent be12b452ed
commit 3d0dfd41c1
1 changed files with 17 additions and 1 deletions

View File

@ -10,7 +10,7 @@ cat << "EOF"
EOF
function show_help () {
echo "Usage: $0 [help] <install | start | stop | full-upgrade>"
echo "Usage: $0 [help] <install | start | stop | full-upgrade | uninstall>"
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)? <y | n> [n]" DELETE_DATA
case "$DELETE_DATA" in
"y" | "Y")
sudo rm -rf data/db/* -v ".gitignore"
;;
*)
exit 0
;;
esac
exit 0
;;
esac
done