Index: openacs-4/etc/install/checkout.sh
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/etc/install/checkout.sh,v
diff -u -r1.5 -r1.6
--- openacs-4/etc/install/checkout.sh	5 Sep 2003 10:23:08 -0000	1.5
+++ openacs-4/etc/install/checkout.sh	5 Sep 2003 14:09:08 -0000	1.6
@@ -25,7 +25,7 @@
 
 # Fetch config parameters
 serverroot=`get_config_param serverroot`
-start_server_command=`get_config_param start_server_command`
+aolserver_user=`get_config_param aolserver_user`
 use_timesaver_files=`get_config_param use_timesaver_files`
 
 echo "$0: Starting checkout for server path $serverroot with config_file $config_file and dotlrn=$dotlrn"
@@ -91,6 +91,5 @@
 # Set proper privileges
 
 # TODO - get service name and group from config file
-chown -R service0.web ${serverroot}
+chown -R ${aolsever_user}.web ${serverroot}
 chmod -R go+rwX ${serverroot}
-
Index: openacs-4/etc/install/config.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/etc/install/Attic/config.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/etc/install/config.tcl	5 Sep 2003 09:39:58 -0000	1.5
+++ openacs-4/etc/install/config.tcl	5 Sep 2003 14:09:08 -0000	1.6
@@ -24,10 +24,15 @@
 set serverroot "/var/lib/aolserver/${server}"
 set server_url "http://localhost:8000"
 set error_log_file "${serverroot}/log/error.log"
+# OS user that AOLserver runs as
+set aolserver_user "${server}"
 
 # the default server control parameters use daemontools
 set use_daemontools "true"
+# Link from this dir. Don't use trailing slash.
 set svscanroot "/var/lib/svscan/${server}"
+# Link to this dir
+set svscan_sourcedir "$serverroot/etc/daemontools"
 set start_server_command "svc -u ${svscanroot}"
 set stop_server_command "svc -d ${svscanroot}"
 set restart_server_command "svc -t ${svscanroot}"
Index: openacs-4/etc/install/install-and-alert.sh
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/etc/install/install-and-alert.sh,v
diff -u -r1.1 -r1.2
--- openacs-4/etc/install/install-and-alert.sh	4 Sep 2003 16:51:26 -0000	1.1
+++ openacs-4/etc/install/install-and-alert.sh	5 Sep 2003 14:09:08 -0000	1.2
@@ -1,11 +1,13 @@
 #!/bin/sh
 #
-# This script runs the dotlrn-install.sh script and sends
+# This script runs the install.sh script and sends
 # an email alert if there are installation errors. The
 # script is intended to be run by cron.
 #
 # Must be executed as root
 
+set -x
+
 # Make script dir current dir for convenience
 script_path=$(dirname $(which $0))
 cd $script_path
@@ -18,7 +20,7 @@
 fi
 
 # Clumsy argument handling, can't use shift as I'm passing
-# the arguments to dotlrn-install.sh
+# the arguments to install.sh
 config_file_next=0
 for arg in $@;
 do
@@ -41,7 +43,7 @@
     mkdir -p $output_dir
 fi
 installation_output_file="${output_dir}/installation-output"
-./dotlrn-install.sh $@ &> $installation_output_file
+./install.sh $@ &> $installation_output_file
 
 # Get lines with alert keywords or lines with failed TclWebtest tests
 error_lines=$(egrep -i "(FAILED: .+\.test)|($alert_keyword)" $installation_output_file)
Index: openacs-4/etc/install/install.sh
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/etc/install/install.sh,v
diff -u -r1.8 -r1.9
--- openacs-4/etc/install/install.sh	5 Sep 2003 10:43:10 -0000	1.8
+++ openacs-4/etc/install/install.sh	5 Sep 2003 14:09:08 -0000	1.9
@@ -12,7 +12,8 @@
 # @author Peter Marklund (peter@collaboraid.biz)
 
 # DEBUG: If any command fails - exit
-#set -e
+set -e
+set -x
 
 # Set the script directory to the current dir for convenience
 script_path=$(dirname $(which $0))
@@ -33,9 +34,21 @@
 # is the same as servername and that the user exists.  Documented
 # in README
 
+# We need to get any config-file path command line setting 
+# before we read the configuration parameters
+config_val_next=0
+for arg in "$@"
+do
+      if [ $config_val_next == "1" ]; then
+          export config_file=$arg
+          config_val_next=0
+      fi
 
-# Parse options
-export config_file="config.tcl"
+      if [ $arg == "--config-file" ]; then
+          config_val_next=1
+      fi
+done
+
 interactive="no"
 usage="$0 [OPTIONS]
     --config-file Sets up information about the server and database used (see config.tcl.in). Defaults to config.tcl
@@ -59,9 +72,11 @@
 fi
 
 # Set important configuration parameters
-server=`get_config_param server`
+export server=`get_config_param server`
 serverroot=`get_config_param serverroot`
+use_daemontools=`get_config_param use_daemontools`
 svscanroot=`get_config_param svscanroot`
+svscan_sourcedir=`get_config_param svscan_sourcedir`
 database=`get_config_param database`
 server_url=`get_config_param server_url`
 error_log_file=`get_config_param error_log_file`
@@ -76,15 +91,14 @@
 dotlrn=`get_config_param dotlrn`
 crawl_links=`get_config_param crawl_links`
 do_checkout=`get_config_param do_checkout`
-use_daemontools=`get_config_param use_daemontools`
 do_install="yes"
 
 # command-line settings override config file settings
 while [ -n "$1" ] ; do
    case "$1" in
       "--config-file")        
+        # We already got this value above so just shift and continue
         shift
-        export config_file=$1
       ;;
       "--no-checkout")
         do_checkout="no"
@@ -128,14 +142,25 @@
     exit -1
 fi
 
+if [ -e $svscanroot ] && ! [ -L $svscanroot ]; then
+    echo "You have a supervise directory $svscanroot which is not a symlink and we curently don't support that."
+    exit -1    
+fi
+
 # Log some important parameters for the installation
-echo "$0: Starting installation with config_file $config_file. Using serverroot=$serverroot, server_url=$server_url, do_checkout=$do_checkout, do_install=${do_install}, dotlrn=$dotlrn, and database=$database."
+echo "$0: Starting installation with config_file $config_file. Using serverroot=$serverroot, server_url=$server_url, do_checkout=$do_checkout, do_install=${do_install}, dotlrn=$dotlrn, and database=$database., use_daemontools=$use_daemontools"
+if parameter_true $use_daemontools; then
+    echo "$0: Daemontools settings: svscanroot=$svscanroot svscan_sourcedir=$svscan_sourcedir"
+fi
+
+# Give the user a chance to abort
 prompt_continue $interactive
 
 # Create the user
 # TODO - make this optional.  Check if the user exists first
-echo "$0: Creating the user $servername at $(date)"
-useradd -m -g web $server -d /home/$server
+#echo "$0: Creating the user $servername at $(date)"
+# Commenting out until this is more robust
+#useradd -m -g web $server -d /home/$server
 
 # stop the server
 echo "$0: Taking down $serverroot at $(date) with command ${stop_server_command}"
@@ -146,7 +171,6 @@
 # cvs checkout later
 # maybe we should do the daemontools check here and not run the stop command
 # if daemontools is true and directory is missing
-
 echo "$0: Waiting $shutdown_seconds seconds for server to shut down at $(date)"
 sleep $shutdown_seconds
 
@@ -160,67 +184,75 @@
     pg_port=`get_config_param pg_port`
     pg_db_name=`get_config_param pg_db_name`
     su  `get_config_param pg_db_user` -c "export LD_LIBRARY_PATH=${pg_bindir}/../lib; ${pg_bindir}/dropdb -p $pg_port $pg_db_name; ${pg_bindir}/createdb -p $pg_port $pg_db_name; ${pg_bindir}/createlang -p $pg_port plpgsql $pg_db_name";
-
 else
     #Oracle
     su oracle -c "cd $script_path; config_file=$config_file ./oracle/recreate-user.sh";
 fi
 
-# The idea of this script is to move away any files or changes
-# to the source tree that we want to keep (for example an
-# edited AOLServer config file, see README)
-if [ -n "$pre_checkout_script" ]; then
-    source $pre_checkout_script
-fi
-
 # Move away the old sources and checkout new ones check do_checkout
 if [ $do_checkout == "yes" ]; then
+
+    # Stop supervising serverroot
+    if parameter_true $use_daemontools; then
+    
+        # Remove supervise link it it exists
+        if [ -e $svscanroot ]; then
+          rm $svscanroot
+        fi
+        
+        # Kill supervise process if any
+        supervise_process=$(ps auxw|grep "supervise $server"|grep -v grep | awk '{print $2}')
+        if [ -n "$supervise_process" ]; then
+          kill -9 $supervise_process
+        fi
+    fi  
+
+    # The idea of this script is to move away any files or changes
+    # to the source tree that we want to keep (for example an
+    # edited AOLServer config file, see README)
+    if [ -n "$pre_checkout_script" ]; then
+        source $pre_checkout_script
+    fi  
+
     echo "$0: Checking out OpenACS at $(date)"
     config_file=$config_file dotlrn=$dotlrn ./checkout.sh
+
+    # The idea of this script is to copy in any files (AOLServer config files,
+    # log files etc.) under the new source tree, and apply any patches
+    # that should be applied (see README).
+    if [ -n "$post_checkout_script" ]; then
+        source $post_checkout_script
+    fi  
     
     # If we are using daemontools, set up the supervise directory
     if parameter_true $use_daemontools; then
 	
-    # Create a daemontools directory if needed
-    	if ! [ -L "${svscanroot}" ] && ! [ -d "${svscanroot}" ] ; then
-            # if we are supposed to use daemontools but there is no control
-            # directory, link the default directory from the cvs tree
-	    # TODO: currently this leaves us with a stranded supervise
-	    # because it was using control files that we moved away.
-	    # The new supervise works fine, but the old one is still
-	    # floating around.  We should either kill the old one directly
-	    # as part of shutdown, or preserve the control files so we can 
-	    # continue using any previous supervise command
+        # Create a daemontools directory if needed
+    	if ! [ -e "${svscanroot}" ] ; then
+            # Supervise dir doesn't exist
+
 	    echo "$0: Creating daemontools directory"
-	    ln -s $serverroot/etc/daemontools $svscanroot
+	    ln -s $svscan_sourcedir $svscanroot
+
             # allow svscan to start
 	    echo "$0: Waiting for $startup_seconds seconds for svscan to come up at $(date)"
 	    sleep $startup_seconds
+
 	    echo "$0: Giving group 'web' control over the server: svgroup web ${svscanroot}"
-        # svgroup may not be on the system, check the PATH
+            # svgroup may not be on the system, check the PATH
 	    if which svgroup &> /dev/null; then
 		svgroup web ${svscanroot}
 	    fi
 	fi
     fi
 fi
 
-# The idea of this script is to copy in any files (AOLServer config files,
-# log files etc.) under the new source tree, and apply any patches
-# that should be applied (see README).
-if [ -n "$post_checkout_script" ]; then
-    source $post_checkout_script
-fi
-
 # Bring up the server again
 echo "$0: Bringing the server $serverroot back up at $date with command $command"
-
 # TODO - if we did checkout, we may have created and linked a 
 # daemontools directory, in which case we already started the 
 # server and this next command is redundant.  Should see if there's
-# an easy way to create a disabled supervise directory that doesn't
-# complicate later startup
-
+# an easy way to create a disabled supervise directory?
 $start_server_command
 
 # Give the server some time to come up
@@ -231,6 +263,11 @@
   # Save the time we started installation
   installation_start_time=$(date +%s)
     
+  if [ $dotlrn == "yes" ]; then
+    # Make sure the dotlrn/install.xml file is at the server root
+    cp $serverroot/packages/dotlrn/install.xml $serverroot
+  fi
+
   # Install OpenACS
   echo "$0: Starting installation of OpenACS at $(date)"
   ${tclwebtest_dir}/tclwebtest -config_file $config_file openacs-install.test
@@ -240,34 +277,24 @@
   $restart_server_command
   echo "$0: Waiting for $restart_seconds seconds for server to come up at $(date)"
   sleep $restart_seconds
+
+  # Extra wait on first startup
+  extra_seconds_wait=300
+  echo "$0: Waiting an extra $extra_seconds_wait seconds here as much initialization of OpenACS and message catalog usually happens at this point"
+  sleep $extra_seconds_wait
+
+  if parameter_true "$dotlrn_demo_data"; then
+      # Do .LRN demo data setup
+      echo "$0: Starting basic setup of .LRN at $(date)"
+      ${tclwebtest_dir}/tclwebtest -config_file $config_file dotlrn-basic-setup.test
+  fi
   
   if [ $database == "postgres" ]; then
       # Run vacuum analyze
       echo "$0: Beginning 'vacuum analyze' at $(date)"
       su  `get_config_param pg_db_user` -c "export LD_LIBRARY_PATH=${pg_bindir}/../lib; ${pg_bindir}/vacuumdb -p $pg_port -z `get_config_param pg_db_name`"
   fi
-  
-  if [ $dotlrn == "yes" ]; then
-      # Install .LRN
-      echo "$0: Starting install of .LRN at $(date)"
-      ${tclwebtest_dir}/tclwebtest -config_file $config_file dotlrn-install.test
-  
-      # Restart the server
-      echo "$0: Restarting server at $(date)"
-      $restart_server_command
-      echo "$0: Waiting for $restart_seconds seconds for server to come up at $(date)"
-      sleep $restart_seconds
-      extra_seconds_wait=300
-      echo "$0: Waiting an extra $extra_seconds_wait seconds here as much initialization of dotLRN and message catalog usually happens at this point"
-      sleep $extra_seconds_wait
-  
-      if parameter_true "$dotlrn_demo_data"; then
-          # Do .LRN demo data setup
-          echo "$0: Starting basic setup of .LRN at $(date)"
-          ${tclwebtest_dir}/tclwebtest -config_file $config_file dotlrn-basic-setup.test
-      fi
-  fi
-  
+    
   if parameter_true $crawl_links; then
       # Search for broken pages
       echo "$0: Starting to crawl links to search for broken pages at $(date)"
Index: openacs-4/etc/install/oracle/recreate-user.sh
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/etc/install/oracle/recreate-user.sh,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/etc/install/oracle/recreate-user.sh	5 Sep 2003 14:08:54 -0000	1.1
@@ -0,0 +1,19 @@
+#!/bin/sh
+# Assumes the envirionment variable config_file to be set
+
+# The drop and create scripts are assumed to be in the same directory as this script
+script_path=$(dirname $(which $0))
+
+source $script_path/../functions.sh
+
+system_user=`get_config_param system_user` 
+system_user_password=`get_config_param system_user_password` 
+oracle_user=`get_config_param oracle_user` 
+oracle_password=`get_config_param oracle_password` 
+
+cat ${script_path}/user-drop.sql | perl -pi -e "s/:oracle_user/$oracle_user/g" | \
+				   sqlplus $system_user/$system_user_password
+
+cat ${script_path}/user-create.sql | perl -pi -e "s/:oracle_user/$oracle_user/g" | \
+                                     perl -pi -e "s/:oracle_password/$oracle_password/g" | \
+				     sqlplus $system_user/$system_user_password 
Index: openacs-4/etc/install/oracle/user-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/etc/install/oracle/user-create.sql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/etc/install/oracle/user-create.sql	5 Sep 2003 14:08:54 -0000	1.1
@@ -0,0 +1,4 @@
+create user :oracle_user identified by :oracle_password default tablespace :oracle_user temporary tablespace temp quota unlimited on :oracle_user;
+grant connect, resource, ctxapp, javasyspriv, query rewrite to :oracle_user;
+revoke unlimited tablespace from :oracle_user;
+alter user :oracle_user quota unlimited on :oracle_user;
Index: openacs-4/etc/install/oracle/user-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/etc/install/oracle/user-drop.sql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/etc/install/oracle/user-drop.sql	5 Sep 2003 14:08:54 -0000	1.1
@@ -0,0 +1 @@
+drop user :oracle_user cascade;
\ No newline at end of file