stage/autorun.sh
changeset 4 c6c431cf0a89
parent 3 859eeb3579b2
child 5 7d3b7009399d
equal deleted inserted replaced
3:859eeb3579b2 4:c6c431cf0a89
    13   mysql=$bitnami/mysql/bin/mysql
    13   mysql=$bitnami/mysql/bin/mysql
    14   test -x "$mysql" || return 1
    14   test -x "$mysql" || return 1
    15 
    15 
    16   return 0
    16   return 0
    17 }
    17 }
       
    18 
       
    19 ## COMPAT
       
    20 
       
    21 # OS X sed (at least leopard and up) seem to support -E
       
    22 sedflags=Ee
       
    23 if ( sed --version 2>&1 | grep 'GNU sed' 2>&1 ) > /dev/null ; then
       
    24 	sedflags=re
       
    25 fi
    18 
    26 
    19 ## SCRIPT
    27 ## SCRIPT
    20 
    28 
    21 cd `dirname $0`
    29 cd `dirname $0`
    22 
    30 
    42 if [ -d $bitnami/apps/enanocms ]; then
    50 if [ -d $bitnami/apps/enanocms ]; then
    43   echo "Enano is already installed as a module on this LAMPStack."
    51   echo "Enano is already installed as a module on this LAMPStack."
    44   exit 1
    52   exit 1
    45 fi
    53 fi
    46 
    54 
    47 mysql_port=$(cat $bitnami/properties.ini | grep mysql_port | sed -re 's/^mysql_port=//g')
    55 mysql_port=$(cat $bitnami/properties.ini | grep mysql_port | sed -$sedflags 's/^mysql_port=//g')
    48 
    56 
    49 while true; do
    57 while true; do
    50   read -s -p "MySQL root password: " mysqlpass
    58   read -s -p "MySQL root password: " mysqlpass
    51   echo ""
    59   echo ""
    52   out=`$mysqladmin -u root --password="$mysqlpass" ping 2>&1`
    60   out=`$mysqladmin -u root --password="$mysqlpass" ping 2>&1`
    78 </Directory>
    86 </Directory>
    79 EOF
    87 EOF
    80 cp ./uninstall.sh $bitnami/apps/enanocms/
    88 cp ./uninstall.sh $bitnami/apps/enanocms/
    81 
    89 
    82 echo "Patching Apache configuration."
    90 echo "Patching Apache configuration."
    83 if test x$(cat $bitnami/apache2/conf/httpd.conf | grep '^Include' | grep enanocms | wc -l) = x0; then
    91 if test "`cat $bitnami/apache2/conf/httpd.conf | grep '^Include' | grep enanocms | wc -l`" -eq 0; then
    84   echo -ne "\nInclude "'"'"$bitnami/apps/enanocms/conf/enanocms?conf"'"'"\n" >> $bitnami/apache2/conf/httpd.conf
    92   echo -ne "\nInclude "'"'"$bitnami/apps/enanocms/conf/enanocms?conf"'"'"\n" >> $bitnami/apache2/conf/httpd.conf
    85 fi
    93 fi
    86 
    94 
    87 echo "Adding Enano to BitNami's applications.html."
    95 echo "Adding Enano to BitNami's applications.html."
    88 if test x$(cat $bitnami/apache2/htdocs/applications.html | fgrep 'START BitNami Enano CMS Module enanocms' | wc -l) = x0; then
    96 if test "`cat $bitnami/apache2/htdocs/applications.html | fgrep 'START BitNami Enano CMS Module enanocms' | wc -l`" -eq 0; then
    89   cp enanocms-module.png $bitnami/apache2/htdocs/img/
    97   cp enanocms-module.png $bitnami/apache2/htdocs/img/
    90   line=$(cat $bitnami/apache2/htdocs/applications.html | fgrep -n '<!-- @@BITNAMI_MODULE_PLACEHOLDER@@ -->' | cut -d ':' -f 1)
    98   line=`cat $bitnami/apache2/htdocs/applications.html | fgrep -n '<!-- @@BITNAMI_MODULE_PLACEHOLDER@@ -->' | cut -d ':' -f 1`
    91   head -n $(($line - 1)) $bitnami/apache2/htdocs/applications.html > ./applications-temp.html
    99   head -n $(($line - 1)) $bitnami/apache2/htdocs/applications.html > ./applications-temp.html
    92   cat application.html >> ./applications-temp.html
   100   cat application.html >> ./applications-temp.html
    93   tail -n +$line $bitnami/apache2/htdocs/applications.html >> ./applications-temp.html
   101   tail -n +$line $bitnami/apache2/htdocs/applications.html >> ./applications-temp.html
    94   mv ./applications-temp.html $bitnami/apache2/htdocs/applications.html
   102   mv ./applications-temp.html $bitnami/apache2/htdocs/applications.html
    95 fi
   103 fi