Added uninstall script and warning about SSE2-only build of GMP
authorDan Fuhry <dan@enanocms.org>
Mon, 05 Jul 2010 14:36:48 -0400
changeset 3 859eeb3579b2
parent 2 7dddb5fb1595
child 4 c6c431cf0a89
Added uninstall script and warning about SSE2-only build of GMP
generate.sh
stage/autorun.sh
stage/uninstall.sh
--- a/generate.sh	Tue Jun 23 09:55:13 2009 -0400
+++ b/generate.sh	Mon Jul 05 14:36:48 2010 -0400
@@ -69,7 +69,7 @@
 rm -f enano-$VERSION.tar.gz
 printf "\nCreating payload..."
 cd stage
-tar cjf ../enano-$VERSION-selfextract.tar.bz2 autorun.sh COPYING enano-$VERSION || fail "Could not create staging tarball"
+tar cjf ../enano-$VERSION-selfextract.tar.bz2 * || fail "Could not create staging tarball"
 rm -rf enano-$VERSION
 cd ..
 printf "\nWriting output..."
--- a/stage/autorun.sh	Tue Jun 23 09:55:13 2009 -0400
+++ b/stage/autorun.sh	Mon Jul 05 14:36:48 2010 -0400
@@ -61,7 +61,7 @@
 bitnami_pass=`dd if=/dev/urandom bs=256 count=1 2>/dev/null | tr -cd '\41-\46\50-\176' | cut -c 1-12`
 
 query='CREATE DATABASE IF NOT EXISTS `'$bitnami_db'`; GRANT ALL PRIVILEGES ON '$bitnami_db'.* TO '"$bitnami_user"'@localhost IDENTIFIED BY '"'$bitnami_pass'"'; FLUSH PRIVILEGES;'
-echo $query | $mysql -u root --password="$mysqlpass" || exit 1
+echo "$query" | $mysql -u root --password="$mysqlpass" || exit 1
 
 echo "Installing files."
 mkdir -p $bitnami/apps/enanocms/{conf,licenses} || exit 1
@@ -77,6 +77,7 @@
     Allow from all
 </Directory>
 EOF
+cp ./uninstall.sh $bitnami/apps/enanocms/
 
 echo "Patching Apache configuration."
 if test x$(cat $bitnami/apache2/conf/httpd.conf | grep '^Include' | grep enanocms | wc -l) = x0; then
@@ -123,3 +124,15 @@
 echo "Restarting Apache."
 $bitnami/ctlscript.sh restart apache
 
+echo
+echo -e "Installation finished, \e[31;1mbut be warned! We are aware of a bug with BitNami's"
+echo -e "copy of GMP.\e[0m If your server doesn't support SSE2, Enano logins may fail. A"
+echo -e "symptom of this problem is messages similar to the following in your Apache"
+echo -e "error log and a blank response when you try to log in to your Enano website:"
+echo
+echo -e "\t[Mon Jul 05 14:22:10 2010] [notice] child pid 26544 exit signal"
+echo -e "\tIllegal instruction (4)"
+echo
+echo -e "If you experience this bug, please report it to BitNami, not the Enano project."
+echo
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stage/uninstall.sh	Mon Jul 05 14:36:48 2010 -0400
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+read -p "Really uninstall Enano including database and config? (type uppercase yes): " confirm
+if test "$confirm" != "YES"; then
+	echo "Uninstallation aborted."
+	exit 1
+fi
+
+bitnami=`dirname $0`/../..
+
+while true; do
+	read -s -p "MySQL root password: " mysqlpass
+	echo ""
+	out=`$bitnami/mysql/bin/mysqladmin -u root --password="$mysqlpass" ping 2>&1`
+	test "$out" = "mysqld is alive" && break
+	echo $out
+done
+
+echo "Removing Enano from Apache configuration."
+cat $bitnami/apache2/conf/httpd.conf | grep -F -v apps/enanocms/conf/ > $bitnami/apache2/conf/httpd.conf.new || exit 1
+mv $bitnami/apache2/conf/httpd.conf $bitnami/apache2/conf/httpd.conf.bak.enanocms-uninstall || exit 1
+mv $bitnami/apache2/conf/httpd.conf.new $bitnami/apache2/conf/httpd.conf || exit 1
+
+$bitnami/ctlscript.sh restart apache
+
+echo "Uninstalling database."
+echo 'DROP DATABASE bn_enanocms; DROP USER bn_enanocms@localhost;' | $bitnami/mysql/bin/mysql -u root --password="${mysqlpass}" || exit 1
+
+echo "Removing Enano from applications.html."
+marker='BitNami Enano CMS Module enanocms'
+startline=`cat $bitnami/apache2/htdocs/applications.html | grep -n "START $marker" | cut -d: -f1`
+endline=`cat $bitnami/apache2/htdocs/applications.html | grep -n "END $marker" | cut -d: -f1`
+nlines=`cat $bitnami/apache2/htdocs/applications.html | wc -l`
+# sanity check...
+if test $startline -gt 0 -a $endline -gt 0 -a $endline -gt $startline -a $nlines -gt $endline ; then
+	cat $bitnami/apache2/htdocs/applications.html | head -n$(($startline - 1)) > $bitnami/apache2/htdocs/applications.html.new
+	cat $bitnami/apache2/htdocs/applications.html | tail -n$(($nlines - $endline)) >> $bitnami/apache2/htdocs/applications.html.new
+	mv $bitnami/apache2/htdocs/applications.html $bitnami/apache2/htdocs/applications.html.bak.enanocms-uninstall || exit 1
+	mv $bitnami/apache2/htdocs/applications.html.new $bitnami/apache2/htdocs/applications.html
+fi
+
+echo "Removing app directory."
+cd $bitnami || exit 1
+cp apps/enanocms/uninstall.sh ./ || exit 1
+rm -rf apps/enanocms/ || exit 1
+