--- a/self-extract-src.sh Mon Jul 05 14:36:48 2010 -0400
+++ b/self-extract-src.sh Mon Jul 05 23:29:07 2010 -0400
@@ -10,6 +10,12 @@
exit 1
fi
+# OS X sed (at least leopard and up) seem to support -E
+sedflags=Ee
+if ( sed --version 2>&1 | grep 'GNU sed' 2>&1 ) > /dev/null ; then
+ sedflags=re
+fi
+
my_which_real()
{
test -n "$1" || return 1
@@ -73,7 +79,7 @@
}
# Go through each required command, and make sure it's on the system. If not, fail.
-for cmd in bzip2 tar grep tail cat wc dd md5sum; do
+for cmd in bzip2 tar grep tail cat wc dd; do
my_which $cmd>/dev/null || exit 1
eval $cmd=`my_which $cmd`
if test x$? = x1; then
@@ -81,6 +87,21 @@
fi
done
+# special case for md5sum
+if my_which_real md5sum 2>&1 > /dev/null; then
+ md5sum=`my_which_real md5sum`
+elif my_which_real openssl 2>&1 > /dev/null; then
+ md5sum=md5sum
+ md5sum()
+ {
+ local f=${1:--}
+ cat $f | openssl dgst -md5 | sed -$sedflags 's/^\(stdin\)= //'
+ }
+else
+ echo "Could not find md5sum or openssl"
+ exit 1
+fi
+
tempdir=""
extractonly=0
while test -n "$1"; do
@@ -90,7 +111,7 @@
if test -n "$2"; then
tempdir=$2
else
- tempdir=`echo $0 | sed -re 's/\.[a-z0-9_-]{1,5}$//'`
+ tempdir=`echo $0 | sed -$sedflags 's/\.[a-z0-9_-]{1,5}$//'`
fi
;;
esac
--- a/stage/autorun.sh Mon Jul 05 14:36:48 2010 -0400
+++ b/stage/autorun.sh Mon Jul 05 23:29:07 2010 -0400
@@ -16,6 +16,14 @@
return 0
}
+## COMPAT
+
+# OS X sed (at least leopard and up) seem to support -E
+sedflags=Ee
+if ( sed --version 2>&1 | grep 'GNU sed' 2>&1 ) > /dev/null ; then
+ sedflags=re
+fi
+
## SCRIPT
cd `dirname $0`
@@ -44,7 +52,7 @@
exit 1
fi
-mysql_port=$(cat $bitnami/properties.ini | grep mysql_port | sed -re 's/^mysql_port=//g')
+mysql_port=$(cat $bitnami/properties.ini | grep mysql_port | sed -$sedflags 's/^mysql_port=//g')
while true; do
read -s -p "MySQL root password: " mysqlpass
@@ -80,14 +88,14 @@
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
+if test "`cat $bitnami/apache2/conf/httpd.conf | grep '^Include' | grep enanocms | wc -l`" -eq 0; then
echo -ne "\nInclude "'"'"$bitnami/apps/enanocms/conf/enanocms?conf"'"'"\n" >> $bitnami/apache2/conf/httpd.conf
fi
echo "Adding Enano to BitNami's applications.html."
-if test x$(cat $bitnami/apache2/htdocs/applications.html | fgrep 'START BitNami Enano CMS Module enanocms' | wc -l) = x0; then
+if test "`cat $bitnami/apache2/htdocs/applications.html | fgrep 'START BitNami Enano CMS Module enanocms' | wc -l`" -eq 0; then
cp enanocms-module.png $bitnami/apache2/htdocs/img/
- line=$(cat $bitnami/apache2/htdocs/applications.html | fgrep -n '<!-- @@BITNAMI_MODULE_PLACEHOLDER@@ -->' | cut -d ':' -f 1)
+ line=`cat $bitnami/apache2/htdocs/applications.html | fgrep -n '<!-- @@BITNAMI_MODULE_PLACEHOLDER@@ -->' | cut -d ':' -f 1`
head -n $(($line - 1)) $bitnami/apache2/htdocs/applications.html > ./applications-temp.html
cat application.html >> ./applications-temp.html
tail -n +$line $bitnami/apache2/htdocs/applications.html >> ./applications-temp.html
--- a/stage/uninstall.sh Mon Jul 05 14:36:48 2010 -0400
+++ b/stage/uninstall.sh Mon Jul 05 23:29:07 2010 -0400
@@ -32,7 +32,7 @@
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
+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
@@ -41,6 +41,5 @@
echo "Removing app directory."
cd $bitnami || exit 1
-cp apps/enanocms/uninstall.sh ./ || exit 1
rm -rf apps/enanocms/ || exit 1