author | Dan Fuhry <dan@enanocms.org> |
Mon, 05 Jul 2010 23:29:07 -0400 | |
changeset 4 | c6c431cf0a89 |
parent 3 | 859eeb3579b2 |
permissions | -rwxr-xr-x |
3
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
1 |
#!/bin/bash |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
2 |
|
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
3 |
read -p "Really uninstall Enano including database and config? (type uppercase yes): " confirm |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
4 |
if test "$confirm" != "YES"; then |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
5 |
echo "Uninstallation aborted." |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
6 |
exit 1 |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
7 |
fi |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
8 |
|
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
9 |
bitnami=`dirname $0`/../.. |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
10 |
|
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
11 |
while true; do |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
12 |
read -s -p "MySQL root password: " mysqlpass |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
13 |
echo "" |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
14 |
out=`$bitnami/mysql/bin/mysqladmin -u root --password="$mysqlpass" ping 2>&1` |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
15 |
test "$out" = "mysqld is alive" && break |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
16 |
echo $out |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
17 |
done |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
18 |
|
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
19 |
echo "Removing Enano from Apache configuration." |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
20 |
cat $bitnami/apache2/conf/httpd.conf | grep -F -v apps/enanocms/conf/ > $bitnami/apache2/conf/httpd.conf.new || exit 1 |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
21 |
mv $bitnami/apache2/conf/httpd.conf $bitnami/apache2/conf/httpd.conf.bak.enanocms-uninstall || exit 1 |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
22 |
mv $bitnami/apache2/conf/httpd.conf.new $bitnami/apache2/conf/httpd.conf || exit 1 |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
23 |
|
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
24 |
$bitnami/ctlscript.sh restart apache |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
25 |
|
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
26 |
echo "Uninstalling database." |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
27 |
echo 'DROP DATABASE bn_enanocms; DROP USER bn_enanocms@localhost;' | $bitnami/mysql/bin/mysql -u root --password="${mysqlpass}" || exit 1 |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
28 |
|
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
29 |
echo "Removing Enano from applications.html." |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
30 |
marker='BitNami Enano CMS Module enanocms' |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
31 |
startline=`cat $bitnami/apache2/htdocs/applications.html | grep -n "START $marker" | cut -d: -f1` |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
32 |
endline=`cat $bitnami/apache2/htdocs/applications.html | grep -n "END $marker" | cut -d: -f1` |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
33 |
nlines=`cat $bitnami/apache2/htdocs/applications.html | wc -l` |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
34 |
# sanity check... |
4 | 35 |
if test "$startline" -gt 0 -a "$endline" -gt 0 -a "$endline" -gt "$startline" -a "$nlines" -gt "$endline" ; then |
3
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
36 |
cat $bitnami/apache2/htdocs/applications.html | head -n$(($startline - 1)) > $bitnami/apache2/htdocs/applications.html.new |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
37 |
cat $bitnami/apache2/htdocs/applications.html | tail -n$(($nlines - $endline)) >> $bitnami/apache2/htdocs/applications.html.new |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
38 |
mv $bitnami/apache2/htdocs/applications.html $bitnami/apache2/htdocs/applications.html.bak.enanocms-uninstall || exit 1 |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
39 |
mv $bitnami/apache2/htdocs/applications.html.new $bitnami/apache2/htdocs/applications.html |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
40 |
fi |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
41 |
|
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
42 |
echo "Removing app directory." |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
43 |
cd $bitnami || exit 1 |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
44 |
rm -rf apps/enanocms/ || exit 1 |
859eeb3579b2
Added uninstall script and warning about SSE2-only build of GMP
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
45 |