# the name of the webservice - will end up as directory under /web/ set SERVICE_NAME "lari" set SERVICE_URL "lari" set WEBROOT "/web" # where OpenACS 4 is checked out set OACS_DIST "/home/tils/openacs/openacs-4" set PSQL "/usr/local/pgsql/bin/psql -p 5433" set NSD_STOP "/etc/init.d/aolserver.$SERVICE_NAME stop" set NSD_START "/etc/init.d/aolserver.$SERVICE_NAME start" # these packages will be copied from the checkout dir to the # installation dir set CORE_PACKAGES { acs-admin acs-subsite acs-api-browser acs-tcl acs-bootstrap-installer acs-templating acs-content acs-util acs-content-repository acs-core-docs skin acs-kernel page acs-mail acs-messaging acs-notification } # ------------------------------------------------------------------ # Clean up the old installation # stop the webserver in case it's still running eval "catch { exec $NSD_STOP 2> /dev/null }" # Save the parameters dir, sinde in my current setup it is being saved # beneath /web/SERVICE_NAME/parameters catch { file delete -force /tmp/install_test } file mkdir /tmp/install_test catch { file copy $WEBROOT/$SERVICE_NAME/parameters/ /tmp/install_test/ } if { [string trim $SERVICE_NAME] == "" } { # sanity. very bad things would happen if it was empty for some # reason error "$SERVICE_NAME should not be empty" } # now wipe out the directory file delete -force $WEBROOT/$SERVICE_NAME # delete the database if it is there set databases [eval "exec $PSQL template1 << \"\\\\l\""] if { [regexp -line "^ $SERVICE_NAME " $databases] } { debug "dropping db $SERVICE_NAME" set sql "DROP DATABASE $SERVICE_NAME" eval "exec $PSQL template1 << \"$sql\"" } else { debug "not dropping db $SERVICE_NAME" } # ------------------------------------------------------------------ # copy the checked out directory into the new location file mkdir $WEBROOT/$SERVICE_NAME foreach file [glob "$OACS_DIST/*"] { if { [string first "packages" $file] > -1 } { file mkdir "$WEBROOT/$SERVICE_NAME/packages" foreach package [glob "$OACS_DIST/packages/*"] { if { [lsearch $CORE_PACKAGES [file tail $package]] > -1 } { file copy $package "$WEBROOT/$SERVICE_NAME/packages" } } } else { file copy "$file" "$WEBROOT/$SERVICE_NAME" } } # and the parameters file file mkdir $WEBROOT/$SERVICE_NAME/parameters foreach file [glob -nocomplain "/tmp/install_test/parameters/*"] { file copy $file $WEBROOT/$SERVICE_NAME/parameters } # create the db set sql "CREATE DATABASE $SERVICE_NAME WITH ENCODING='UNICODE'" eval "exec $PSQL template1 << \"$sql\"" # wait a bit, otherwise the db will not be found by the webserver debug "waiting after db creation" after [expr 10 * 1000] # ------------------------------------------------------------------ # start the webserver eval "exec $NSD_START 2> start.out" debug "waiting a bit after start of $SERVICE_NAME" after [expr 15 * 1000] # ------------------------------------------------------------------ # start the installation process do_request "http://$SERVICE_URL" # install the datamodel (hopefully) form find debug "pushing the button" form submit # scan for available packages form submit assert text "All Packages Installed" form submit # add admin field fill tils@tils.net field fill "Tilmann" field fill "Singer" field fill "tils" field fill "tils" field select "hvad" field fill "huh?" form submit debug "Result of adding admin: [response body]" # set system information form submit # restart eval "exec $NSD_STOP 2> /dev/null" after [expr 10 * 1000] eval "exec $NSD_START 2> /dev/null"