Index: hostmaster/install.sh.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/profiles/hostmaster/install.sh.txt,v
retrieving revision 1.4
diff -u -p -r1.4 install.sh.txt
--- hostmaster/install.sh.txt	17 Jul 2009 11:26:27 -0000	1.4
+++ hostmaster/install.sh.txt	1 Aug 2009 00:05:10 -0000
@@ -27,8 +27,15 @@ aegir_environment () {
 
     # Specific to this environment
     apt-get -y install openssh-server;
-    apt-get -y install sendmail;
-
+    # Sendmail installation will remove postfix or exim4 if installed. 
+    # Don't install sendmail unless neither postfix nor exim4 are installed
+    checkmail=`apt-cache policy postfix | grep none`
+    if [[ $checkmail =~ none ]]; then
+      checkmail=`apt-cache policy exim4 | grep none`
+      if [[ $checkmail =~ none ]]; then
+        apt-get -y install sendmail;
+      fi
+    fi
     # Required components
     apt-get -y install wget cvs;
     apt-get -y install mysql-server-5.0;
@@ -44,10 +51,10 @@ aegir_environment () {
     ###
     ### Aegir user setup
     ###
-    
-    AEGIR_USER="aegir"
+
+    AEGIR_USER="aegir" 
     create_user
-    
+
     a2enmod php5;
     a2enmod rewrite;
     
@@ -98,7 +105,7 @@ create_user () {
   read whatever
   adduser $AEGIR_USER --home /var/$AEGIR_USER;
   su - $AEGIR_USER;
-  
+ 
   find_httpd
   find_web_group
 
@@ -125,7 +132,7 @@ edit_visudo () {
 
 aegir_user () {
   aegir_title "SECTION 1 : Aegir user account"
-  echo "Aegir is designed to run as it's own user that was created specifically for it."
+  echo "Aegir is designed to run as its own user that was created specifically for it."
   if [ $AEGIR_USER != '' ]; then
     echo "Installing Aegir as the $AEGIR_USER user, already created."
     aegir_user_home
@@ -304,8 +311,13 @@ aegir_vhost () {
   
   find_apachectl
   find_httpdconf
-  echo "Include $CONF_DIR" >> $HTTPD_CONF
-  $APACHECTL_BIN restart;
+  if grep -q "Include $CONF_DIR" $HTTPD_CONF
+  then 
+    echo "$CONF_DIR has already been included in $HTTPD_CONF, possibly from a previous installation, skipping.."
+  else
+    echo "Include $CONF_DIR" >> $HTTPD_CONF 
+    $APACHECTL_BIN restart
+  fi
 }
 
 find_httpdconf () {
@@ -316,9 +328,16 @@ aegir_database () {
   aegir_title "SECTION 5 : Setting up MySQL"
   found=""
   while [ -z "$found" ]; do
+    aegir_prompt "MySQL root username [root]:"
+    read MYSQLUSER
+    if [ -z $MYSQLUSER ]; then
+      MYSQLUSER="root";
+    fi;
     aegir_prompt "MySQL root user password : "
-    read DBPASS
-    found=`mysqladmin -uroot -p$DBPASS ping`
+    stty -echo
+    read DBPASS; echo
+    stty echo
+    found=`mysqladmin -u$MYSQLUSER -p$DBPASS ping`
   done;
   
   echo "Creating mysql database for hostmaster site :"
@@ -328,7 +347,7 @@ aegir_database () {
     HMDB="hostmaster";
   fi;
   
-  mysqladmin -uroot -p$DBPASS create $HMDB
+  mysqladmin -u$MYSQLUSER -p$DBPASS create $HMDB
 
   echo "Creating $HMDB user account :"
   aegir_prompt "Username [hostmaster]:"
@@ -338,10 +357,12 @@ aegir_database () {
   fi;
 
   aegir_prompt "Password:"
-  read HMPASS
+  stty -echo
+  read HMPASS; echo
+  stty echo
 
   echo "GRANT ALL ON $HMDB.* TO '$HMUSER'@'localhost' IDENTIFIED BY '$HMPASS'" | 
-  mysql -uroot  -p$DBPASS $HMDB
+  mysql -u$MYSQLUSER  -p$DBPASS $HMDB
   
   echo "Creating aegir mysql superuser account :"
   aegir_prompt "Username [aegir]:"
@@ -351,10 +372,12 @@ aegir_database () {
   fi;
 
   aegir_prompt "Password:"
-  read AEPASS
+  stty -echo
+  read AEPASS; echo
+  stty echo
 
   echo "GRANT ALL PRIVILEGES ON *.* TO '$AEUSER'@'localhost' IDENTIFIED BY '$AEPASS' WITH GRANT OPTION" | 
-  mysql -uroot  -p$DBPASS $HMDB
+  mysql -u$MYSQLUSER  -p$DBPASS $HMDB
 }
 
 aegir_install () {
