summaryrefslogtreecommitdiff
path: root/osx/uninstall-pandoc
blob: db2001da1d496204640db2c71b183a611b9deaec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh -e
# This script (when run with root permissions) uninstalls
# everything installed by the Pandoc Mac OS X installer.

if [ "`id -u`" != 0 ]; then \
	echo "This script must be run with root privileges:"; \
    echo "sudo /usr/local/bin/uninstall-pandoc"; \
	exit 1; \
fi

MAN_PAGES="pandoc.1 markdown2pdf.1 html2markdown.1 hsmarkdown.1"
EXECUTABLES=`echo $MAN_PAGES | sed -e 's#\.1##g'`
EXECUTABLES="$EXECUTABLES uninstall-pandoc"
DOCUMENTS="`ls /usr/local/share/doc/pandoc`"
TOREMOVE=""
for F in $EXECUTABLES; do
	TOREMOVE="$TOREMOVE /usr/local/bin/$F";
done
for F in $MAN_PAGES; do
	TOREMOVE="$TOREMOVE /usr/local/share/man/man1/$F"; 
done
for F in $DOCUMENTS; do
	TOREMOVE="$TOREMOVE /usr/local/share/doc/pandoc/$F";
done
TOREMOVE="$TOREMOVE /usr/local/share/doc/pandoc"

echo "This script will remove all of the files installed"
echo "by the Pandoc Mac OS X installer: $TOREMOVE"
echo "Are you sure you want to continue with this?"

OPTIONS="Continue Quit"
select opt in $OPTIONS; do
	if [ "$opt" = "Quit" ]; then
		exit 0
	elif [ "$opt" = "Continue" ]; then
		echo "Removing..."
		rm -rv $TOREMOVE
		echo "Successfully removed Pandoc."
		exit 0
	else
		echo "Bad option."
	fi
done