Ind.ie is now Small Technology Foundation.
uninstall 3.07 KB
Newer Older
Aral Balkan's avatar
Aral Balkan committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#!/bin/sh

set -e

################################################################################
#
#	Better Uninstaller.
#
#	Removes installed components *and content/data*.
#
#	This is Independent Technology.
#
#	▲❤ We practice Ethical Design (https://ind.ie/ethical-design)
#
#	© Aral Balkan. © Ind.ie. All Rights Reserved.
#	Released with love by Ind.ie under GNU AGPLv3 or later.
#	Free as in freedom. Please see the LICENSE file.
#
################################################################################

uninstall(){
	echo "\n Uninstalling Better and all its data and contents.\n"

24
	echo "  · Deleting all components.\n"
Aral Balkan's avatar
Aral Balkan committed
25

26
	indentOutput "git clean -ffXd"
Aral Balkan's avatar
Aral Balkan committed
27

28
	echo "\n  · Deleting all data and content."
Aral Balkan's avatar
Aral Balkan committed
29 30 31 32 33 34 35

	rm -rf ~/better.fyi

	echo "\n Uninstallation complete.\n"
	echo " To re-install a fresh copy of Better, run the ./install script.\n"
}

36 37 38 39 40 41 42 43
# Runs the passed command, formatting the output with the passed indentation (default: 4 spaces)
indentOutput(){
	commandToRun=$1
	indentation=${2:-'  '}

	script -q /dev/null $1 | LC_ALL=C sed "s/^/${indentation} · /g"
}

Aral Balkan's avatar
Aral Balkan committed
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
secondConfirmation(){
	echo "\n Are you really, really sure (last chance)?\n"

	select yn in "Yes" "No"; do
		case $yn in
			Yes ) uninstall; break;;
			No ) echo "\n Whew, that was close!\n\n Uninstall aborted.\n"; exit;;
		    *) echo "\n Please enter 1 for Yes and 2 for No.";continue;;
		esac
	done
}

greeting(){
	echo ""
	echo "  ____       _   _            ";
	echo " |  _ \     | | | |           ";
	echo " | |_) | ___| |_| |_ ___ _ __ ";
	echo " |  _ < / _ \ __| __/ _ \ '__|";
	echo " | |_) |  __/ |_| ||  __/ |   ";
	echo " |____/ \___|\__|\__\___|_|   ";
	echo ""
	echo " ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ";
	echo " ░                                                                               ░ ";
	echo " ░  (!) UNINSTALLER                                                              ░ ";
	echo " ░                                                                               ░ ";
	echo " ░  This will uninstall all components, data, *and* contents under ~/better.fyi. ░ ";
	echo " ░                                                                               ░ ";
	echo " ░  (It will delete all content, themes, drafts, your HTTP archive, etc.)        ░ ";
	echo " ░                                                                               ░ ";
	echo " ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ";
	echo ""
	echo " Are you sure you want to delete everything?\n"

PS3="
> "
	select yn in "Yes" "No"; do
		case $yn in
			Yes ) secondConfirmation; break;;
			No ) echo "\n Uninstall aborted.\n"; exit;;
		    *) echo "\n Please enter 1 for Yes and 2 for No.";continue;;
		esac
	done
}

greeting