Index: openacs-4/etc/install/README =================================================================== RCS file: /usr/local/cvsroot/openacs-4/etc/install/README,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/etc/install/README 4 Sep 2003 16:51:26 -0000 1.1 @@ -0,0 +1,97 @@ +OpenACS/dotLRN automated install script + +Prerequisites: +tclwebtest +aolserver +oracle or postgresql + +see /packages/acs-core-docs/www/index.html for more documentation +about installing OpenACS and its prerequisites + +Quick Guide + +edit config.tcl +./install.sh + +By default, this will + 1) stop any OpenACS service supervised at /var/lib/svscan/service0 + 2) drop the database service0 if it exists + 3) update or create a CVS HEAD checkout of OpenACS at + /var/lib/aolserver/service0 + 4) create the database service0 + 5) install OpenACS, including configuring the web-driven pages, to + http://localhost:8000 + +*** Before running install.sh script please check that: + +0) If you already have a server running that is to be recreated - move +away and save any local changes (patches) that you have made to the +source code. The whole source code tree of the server will be moved +away to temporary storage and deleted on the next recreation. Any +patches that you want to apply on recreation should be executed by a +script specified in the config file (see below) as +post_checkout_script. This script will be executed after checkout is +completed. Per default there is no such script but remember to use +such a script if you wish to copy for example a log directory and +AOLServer config file into the source tree of the server (to avoid +having to do this I usually keep my AOLServer config and log files +outside the source tree, i.e. under /usr/local/aolserver rather than + under /web/server_name). If you do keep such files in the server tree +you should save them before the checkout with the pre_checkout_script +(specify path in config file), otherwise any changes to the AOLServer +config file will be lost as the whole server tree is moved away for a +new checkout from CVS. + +1) A tablespace must exist with the same name as the oracle user of +the server. The oracle recreate script uses statements from +http://www.pinds.com/acs-tips/oracle-statements. Make sure you +are not connected to the database user that the server uses +so that that user can be dropped (i.e. log out of any sqlplus or +psql sessions you might have). + +2) Use config.tcl.in (don't edit this file, it's just a template) to create + a server specific installation config file. Per default install.sh + will use the file config.tcl in the same directory but you can specify + any config file on the command line with the switch --config-file. + +3) Make sure an AOLServer config file is prepared. You can use +/etc/config.tcl as a template you are probably better off using any +existing config files on your server as templates instead. As far as +I know TCLWebTest cannot handle port numbers in URLs so try +to avoid those (use port 80 or use virtual hosting). This is a known tcl bug: + +http://sourceforge.net/tracker/index.php?func=detail&aid=452217&group_id=10894&atid=110894 + +that is supposedly fixed in some recent version of TCL. + +4) If you are using supervise (svc) to manage your server you need + to create a run script and specify its path in + the variable run_script in the config file. You may use run.in + as a template. Per default the file run in the same directory as + install.sh will be used. + +5) The server you are to create/recreate must be under supervise +(i.e. ln -s /web/dotlrn-test /service/dotlrn-test). + +6) Make sure you have root access since you must run install.sh +as root. + +7) Fetch a fresh checkout from CVS of TclWebTest (see http://tclwebtest.sourceforge.net) and +specify the directory the tclwebtest executable resides in in your config file (the default config file is config.tcl). + +*** The install.sh script roughly does the following by default + (there are switches, use install.sh --help): + +1) Takes down your old server, moves away the old source code (be +careful so you don't loose local changes) and checks out new sources. + +2) Recreates the database user. + +3) Installs OpenACS and .LRN over HTTP using TclWebTest. + +4) Sets up a few .LRN users and classes with TclWebTest + +When the script finishes it brings the new server up so that you can +login with the site-wide admin user. There are switches to use PostgreSQL +rather than Oracle and to only install OpenACS, invoke +install.sh --help for details. Index: openacs-4/etc/install/TODO =================================================================== RCS file: /usr/local/cvsroot/openacs-4/etc/install/TODO,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/etc/install/TODO 4 Sep 2003 16:51:26 -0000 1.1 @@ -0,0 +1 @@ +- TclWebTest selects options in selects bases on label rather than value. I would like to be able to select based on value. \ No newline at end of file Index: openacs-4/etc/install/aolserver-errors.pl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/etc/install/aolserver-errors.pl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/etc/install/aolserver-errors.pl 4 Sep 2003 16:51:26 -0000 1.1 @@ -0,0 +1,186 @@ +#!/usr/bin/perl -i + +# aolserver-errors.pl +# +# prints out the errors from an AOLserver error log +# +# dvr@arsdigita.com, 11/27/99 +# +# USAGE: +# +# aolserver-errors -b +# +# print all errors found in the last of +# the error log. +# +# aolserver-errors -m +# +# print all errors logged in the last +# minutes +# +# +# If called with no options, it will default to +# +# aolserver-errors -200000b +# +# +############################################################# +# +# Modification History: +# +# 1/1/2000 -- Removed reliance on the POSIX module and got the +# parameter working correctly. +# +# 1/15/2000 -- replaced all calls to 'tail` with seek() calls +# to improve portability. This also allows us to compile this script +# with perlcc to create a single binary that should work under +# a chroot'ed server. +# +# 2/01/2000 -- fixed a bug that caused trouble the first of every +# month. (Now the problem happens only on the first of each year) +# +# 5/12/2000 -- mbryzek@arsdigita.com +# Added exit at end of script to kill the thread + +$num_args = scalar @ARGV; + +# the number of bytes to read from the end of the file when +# we're trying to find all errors in the last N minutes. +$bite_size = 200000; + +# The default size for the -b parameter +$default_num_bytes = 200000; + +%month_num = ('Jan', '00', + 'Feb', '01', + 'Mar', '02', + 'Apr', '03', + 'May', '04', + 'Jun', '05', + 'Jul', '06', + 'Aug', '07', + 'Sep', '08', + 'Oct', '09', + 'Nov', '10', + 'Dec', '11'); + +foreach $arg_num (0 .. ($num_args - 2)) { + $arg = $ARGV[$arg_num]; + + if ($arg =~ /\-([0-9]+)([A-Za-z])/) { + ($number, $type) = ($1, lc($2)); + + if ($type eq 'b') { + $num_bytes = $number; + } elsif ($type eq 'm') { + $num_minutes = $number; + } else { + die "Bad option: $arg\n"; + } + } else { + die "Bad option: $arg\n"; + } +} + +$log_file = $ARGV[-1]; + +open LOG, "< $log_file"; + +if ($num_minutes) { + $start_time = sprintf "%02d%02d%02d%02d", (localtime(time - (60*$num_minutes)))[4,3,2,1]; + + seek LOG, -$bite_size, 2; + + while (1) { + while () { + if (/^\[([0-9]+)\/([A-Za-z]+)\/([0-9]+):([0-9]+):([0-9]+)/) { + my($day, $month_name, $year, $hour, $minute) = ($1, $2, $3, $4, $5); + + $log_time = $month_num{$month_name} . $day . $hour . $minute; + + if ($log_time lt $start_time) { + + # We've gone too far back. Advance until we find + # an error that's on or past $start_time + + $last_position = tell LOG; + + while () { + if (/^\[([0-9]+)\/([A-Za-z]+)\/([0-9]+):([0-9]+):([0-9]+)/) { + my($day, $month_name, $year, $hour, $minute) = ($1, $2, $3, $4, $5); + + $log_time = $month_num{$month_name} . $day . $hour . $minute; + + if ($start_time le $log_time) { + $starting_point = $last_position; + last; + } + } + $last_position = tell LOG; + } + # Either we've found the line we want or have reached + # the end of the file. If it's the second case, we + # need to set the starting point to the end of the file. + $starting_point = $last_position unless $starting_point; + } + # We only need to get one time stamp + last; + } + } + + last if defined $starting_point; + + seek LOG, -$bite_size, 1; + + $position = tell LOG; + + if ($position < $bite_size) { + # then we need to read the entire file + $starting_point = 0; + last; + } + } +} + +if (defined $starting_point) { + seek LOG, $starting_point, 0; +} else { + $num_bytes = $default_num_bytes unless $num_bytes; + seek LOG, -$num_bytes, 2; +} + +$in_error = 0; +$in_following_notice = 0; + +while () { + if (/^\[(.*?)\]\[(.*?)\][^ ]? (.*)/) { + ($time, undef, $message) = ($1, $2, $3); + + unless ($first_log_time) { + ($first_log_time) = ($time =~ /^([^ ]+)/); + print "Errors since $first_log_time\n"; + } + + if ($message =~ /^Error/) { + print "\n[$time]\n $message\n"; + $in_error = 1; + $in_following_notice = 0; + } elsif ($message =~ /^Notice/) { + if ($in_error == 1) { + $in_following_notice = 1; + } else { + $in_following_notice = 0; + } + $in_error = 0; + print " $message\n" if $in_following_notice; + } else { + $in_error = 0; + $in_following_notice = 0; + } + } else { + print " $_" if ($in_error or $in_following_notice); + } +} +close LOG; + +exit(0); Index: openacs-4/etc/install/check-errors-output.sh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/etc/install/check-errors-output.sh,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/etc/install/check-errors-output.sh 4 Sep 2003 16:51:26 -0000 1.1 @@ -0,0 +1,8 @@ +#!/bin/sh + +file_name=$1 + +# FIXME: Ignore InterMedia errors for now +egrep -i 'error' $file_name | egrep -i -v 'no error' | egrep -v -i 'ODCIINDEXCREATE|Intermedia' + +exit 0 Index: openacs-4/etc/install/checkout.sh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/etc/install/checkout.sh,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/etc/install/checkout.sh 4 Sep 2003 16:51:26 -0000 1.1 @@ -0,0 +1,116 @@ +#!/bin/bash +# +# Read the README file before executing this script. +# +# Checks out all source code needed for .LRN from CVS and copies +# the supervise run script that runs AOLServer to the server root directory. +# +# This script should be executed as root and requires the following +# environment variables to be set: +# +# config_file - where variables such as the server_path are kept +# dotlrn - (yes or no) Indicates if dotlrn should be checked out +# +# environment variable to be set. It is based on instructions +# at http://dotlrn.openforce.net/dotlrn/doc/dotlrn-install +# +# @author Peter Marklund (peter@collaboraid.biz) + +export CVS_RSH=ssh +script_path=$(dirname $(which $0)) + +cd $script_path + +# Sometimes script path will be the dot so I need this workaround +script_path=$PWD + +source functions.sh + +# Fetch config parameters +server_path=`get_config_param server_path` +start_server_command=`get_config_param start_server_command` +pre_checkout_script=`get_config_param pre_checkout_script` +post_checkout_script=`get_config_param post_checkout_script` +use_timesaver_files=`get_config_param use_timesaver_files` + +echo "$0: Starting checkout for server path $server_path with config_file $config_file and dotlrn=$dotlrn" + +# 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 +if [ -d ${server_path} ]; then + + # Remove old tmp storage of sources + server_name=$(basename ${server_path}) + old_sources_path="/tmp/${server_name}" + if [ -d ${old_sources_path} ]; then + echo "$0: removing old server sources at ${old_sources_path}" + rm -rf ${old_sources_path} + fi + + echo "$0: Moving sources at ${server_path} to ${old_sources_path}" + mv ${server_path} ${old_sources_path} +fi + +# Checkout OpenACS core +mkdir -p ${server_path}-tmp +cd ${server_path}-tmp +oacs_branch=`get_config_param oacs_branch` +if [ -z "$oacs_branch" ]; then + oacs_branch="HEAD" +fi +echo "$0: Checking out acs-core from branch $oacs_branch" +cvs -q -d :pserver:anonymous:@openacs.org:/cvsroot login +cvs -q -z3 -d :pserver:anonymous@openacs.org:/cvsroot checkout -r $oacs_branch acs-core +mv ${server_path}-tmp/openacs-4 ${server_path} +rmdir ${server_path}-tmp + +if [ $dotlrn == "yes" ]; then + # Checkout needed packages + echo "$0: Checking out packages from branch $oacs_branch" + cd ${server_path}/packages + cvs -q -z3 -d :pserver:anonymous@openacs.org:/cvsroot co -r $oacs_branch \ + acs-datetime acs-developer-support acs-events acs-mail-lite \ + attachments bulk-mail calendar faq file-storage forums general-comments \ + news notifications ref-timezones user-preferences + + # Copy short reference files to save time when installing datamodel + if parameter_true "$use_timesaver_files"; then + echo "$0: Copying timesaver files" + cp ${script_path}/ref-timezones-rules.sql \ + ${server_path}/packages/ref-timezones/sql/common + cp ${script_path}/ref-timezones-data.sql \ + ${server_path}/packages/ref-timezones/sql/common + fi + + # Checkout .LRN + dotlrn_branch=`get_config_param dotlrn_branch` + if [ -z "$dotlrn_branch" ]; then + dotlrn_branch="HEAD" + fi + echo "$0: Checking out .LRN from branch $dotlrn_branch" + cvs -q -d :pserver:anonymous:@dotlrn.openforce.net:/dotlrn-cvsroot login + cvs -q -z3 -d :pserver:anonymous@dotlrn.openforce.net:/dotlrn-cvsroot \ + co -r $dotlrn_branch dotlrn-core + + # Copy graphics files + echo "$0: Copying graphics files" + mkdir ${server_path}/www/graphics + cp ${server_path}/packages/dotlrn/www/graphics/* ${server_path}/www/graphics +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 + +# Set proper privileges +chown -R nsadmin.web ${server_path} +chmod -R 775 ${server_path} Index: openacs-4/etc/install/config.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/etc/install/Attic/config.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/etc/install/config.tcl 4 Sep 2003 16:51:26 -0000 1.1 @@ -0,0 +1,84 @@ +# TCLWebTest configuration +set tclwebtest_dir "/usr/local/tclwebtest" + + +set server "service0" + +# Choose database - oracle or postgres +set database "postgres" + +# Oracle configuration +set oracle_user "${server}" +set oracle_password "${oracle_user}" +set system_user "system" +set system_user_password "manager" + +# PostgreSQL configuration +# system account for postgres +set pg_db_user "postgres" +set pg_db_name ${server} +set pg_host localhost +set pg_port 5432 +set pg_bindir "/usr/local/pgsql/bin" + +# AOLServer configuration +set serverroot "/var/lib/aolserver/${server}" +set svscanroot "/var/lib/svscan" +set server_url "http://localhost:8000" +set error_log_file "${serverroot}/log/error.log" +set start_server_command "svc -u ${svscanroot}/$server" +set stop_server_command "svc -d ${svscanroot}/$server" +set restart_server_command "svc -t ${svscanroot}/$server" +# Time from invocation of startup command until the server is actually up +set startup_seconds 20 +# Time from invocation of shutdown command until the server is actually down +set shutdown_seconds 10 + +# OpenACS configuration +set admin_email "postmaster@localhost" +set admin_first_names "Admin" +set admin_last_name "User" +set admin_password "1" +set admin_password_question "Hello - is there anybody out there?" +set admin_password_answer "1853" +set system_name "OpenACS Test System" +set publisher_name "Yourname" +set system_owner_email "$admin_email" +set admin_owner_email "$admin_email" +set host_administrator_email "$admin_email" +set outgoing_sender_email "$admin_email" +set new_registrations_email "$admin_email" + +# Set to yes to not install full ref-timezones and save time during +# datamodel install. Set to no for production servers. +set use_timesaver_files "no" + +# dotLRN configuration +# should we install dotlrn? +set dotlrn "no" + +# Should basic demo setup of departments, classes, users, etc. be done? +set dotlrn_demo_data "no" +set dotlrn_users_data_file "users-data.csv" +set demo_users_password "guest" +# Should links be crawled to search for broken pages? +set crawl_links "no" + +# CVS variables +set oacs_branch "HEAD" +set dotlrn_branch "HEAD" +set do_checkout "yes" +# To use if you have your AOLServer config file under server_root (see README) +# Only executes if checkout is done +set pre_checkout_script "" +# To use if you have your AOLServer config file under server_root (see README) +# Only executes if checkout is done +set post_checkout_script "" + +# The keyword outputed by the install script to indicate +# that an email alert should be sent +set alert_keyword "INSTALLATION ALERT" +set send_alert_script "send-alert" +set openacs_output_file "${serverroot}/log/install-openacs-data-model-output.html" +set openacs_packages_output_file "${serverroot}/log/install-openacs-packages-install-output.html" +set apm_output_file "${serverroot}/log/install-apm-packages-output.html" Index: openacs-4/etc/install/dotlrn-basic-setup.test =================================================================== RCS file: /usr/local/cvsroot/openacs-4/etc/install/dotlrn-basic-setup.test,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/etc/install/dotlrn-basic-setup.test 4 Sep 2003 16:51:26 -0000 1.1 @@ -0,0 +1,60 @@ +if { [catch { + # Source procedures + source tclwebtest-functions.tcl + + # Test Execution START + + # Login the site wide admin + login_site_wide_admin + + # We need a few users + upload_users $server_url + + # We want the users to have a known password so people can log in with them + set_users_passwords $server_url + + # Add the site wide admin to dotLRN + add_site_wide_admin_to_dotlrn $server_url + + # Setup a few terms + setup_terms $server_url + + # Departments + setup_departments $server_url + + # Setup subjects + setup_subjects $server_url + + # We can now add a few classes + setup_classes $server_url + + # Setup members, i.e. professors, students and assistants + setup_class_memberships $server_url + + # We want to show off the subgroup functionality + setup_class_subgroups $server_url + + # Sloan uses this member list - only add it for the computing classes + # So that we can demo adding it to other classes + add_member_applet_to_classes $server_url + + # Add a default forum to each class + add_default_class_forums $server_url + + # Add some communities as well (i.e. Tennis Club etc.) + setup_communities $server_url + + # Add some news items to each class + add_class_news_items $server_url + + # Test Execution END +} result] } { + global errorInfo + puts stderr $result + puts stderr "*** Tcl TRACE ***" + puts stderr $errorInfo + + puts "The response body is: [response body]" + + error "Test failed: $result" +} Index: openacs-4/etc/install/dotlrn-links-check.test =================================================================== RCS file: /usr/local/cvsroot/openacs-4/etc/install/Attic/dotlrn-links-check.test,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/etc/install/dotlrn-links-check.test 4 Sep 2003 16:51:26 -0000 1.1 @@ -0,0 +1,28 @@ +if { [catch { + # Source procedures + source tclwebtest-functions.tcl + + # Test Execution START + + # Login the site wide admin + login_site_wide_admin + + puts "crawling links starting from /dotlrn" + lappend __url_history "${server_url}/dotlrn" + crawl_links + + puts "crawling links starting from /dotlrn/admin" + lappend __url_history "${server_url}/dotlrn/admin" + crawl_links + + # Test Execution END +} result] } { + global errorInfo + puts stderr $result + puts stderr "*** Tcl TRACE ***" + puts stderr $errorInfo + + puts "The response body is: [response body]" + + error "Test failed: $result" +} Index: openacs-4/etc/install/functions.sh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/etc/install/functions.sh,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/etc/install/functions.sh 4 Sep 2003 16:51:26 -0000 1.1 @@ -0,0 +1,35 @@ +# Access config parameters in the TCL file through this function + +get_config_param () { + echo "source $config_file; puts [set $1]" | tclsh +} + + +# present an interactive continue prompt. +# Quit the script if user chooses no. +prompt_continue () { + + interactive=$1 + + if [ "$interactive" == "yes" ]; then + echo "Continue? (y/n)" + read continue + if [ "$continue" == "n" ]; then + echo "$0: exiting on users request" + exit + fi + fi +} + + +# convert y, Y, t, and T to true and other values to false +parameter_true () { + case "$1" in + [yY]*|[tT]*) + true + ;; + *) + false + ;; + esac +} 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/etc/install/install-and-alert.sh 4 Sep 2003 16:51:26 -0000 1.1 @@ -0,0 +1,51 @@ +#!/bin/sh +# +# This script runs the dotlrn-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 + +# Make script dir current dir for convenience +script_path=$(dirname $(which $0)) +cd $script_path + +source functions.sh + +# Get a proper environment set up +if [ -f ~/.bashrc ]; then + source ~/.bashrc +fi + +# Clumsy argument handling, can't use shift as I'm passing +# the arguments to dotlrn-install.sh +config_file_next=0 +for arg in $@; +do + if [ "$config_file_next" == "1" ]; then + export config_file="$arg" + config_file_next=0 + fi + + if [ "$arg" == "--config-file" ]; then + config_file_next="1" + fi +done + +alert_keyword=`get_config_param alert_keyword` +send_alert_script=`get_config_param send_alert_script` +export server=`get_config_param server` + +output_dir="server-output/${server}" +if [ ! -d ${output_dir} ]; then + mkdir -p $output_dir +fi +installation_output_file="${output_dir}/installation-output" +./dotlrn-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) + +if [ -n "$error_lines" ]; then + $send_alert_script "$error_lines" > /dev/null +fi Index: openacs-4/etc/install/install.sh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/etc/install/install.sh,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/etc/install/install.sh 4 Sep 2003 16:51:26 -0000 1.1 @@ -0,0 +1,233 @@ +#!/bin/bash +# +# Read the README file before executing this script. +# +# This script recreates an OpenACS server from scratch by: +# + +# - dropping and adding the database +# - Re-checking out the source code from CVS +# - Doing necessary installation and configuration of OpenACS and +# .LRN over HTTP that is normally done manually in a browser. +# +# @author Peter Marklund (peter@collaboraid.biz) + +# DEBUG: If any command fails - exit +#set -e + +# Set the script directory to the current dir for convenience +script_path=$(dirname $(which $0)) +cd $script_path + +source functions.sh + +# Parse options +export config_file="config.tcl" +interactive="no" +usage="$0 [OPTIONS] + --config-file Sets up information about the server and database used (see config.tcl.in). Defaults to config.tcl + --no-checkout Do not checkout new source code + --oacs-only Do not install .LRN, only OpenACS + --postgresql Install on PostgreSQL. Overrides database setting in install config file. + --interactive Gives you the possibility to exit at certain points during installation +" + +# Check that script is executed as root +if [ $(whoami) != "root" ]; then + echo "$0: You must execute this script as root, exiting" + exit -1 +fi + +# Check that the config file exists +if [ ! -r ${config_file} ]; then + echo "$0: Aborting installation. The config file \"$config_file\" does not exist or is not readable." + exit -1 +fi + +# Set important configuration parameters +serverroot=`get_config_param serverroot` +database=`get_config_param database` +server_url=`get_config_param server_url` +error_log_file=`get_config_param error_log_file` +tclwebtest_dir=`get_config_param tclwebtest_dir` +stop_server_command=`get_config_param stop_server_command` +start_server_command=`get_config_param start_server_command` +restart_server_command=`get_config_param restart_server_command` +startup_seconds=`get_config_param startup_seconds` +shutdown_seconds=`get_config_param shutdown_seconds` +restart_seconds=$(expr $startup_seconds + $shutdown_seconds) +dotlrn_demo_data=`get_config_param dotlrn_demo_data` +dotlrn=`get_config_param dotlrn` +crawl_links=`get_config_param crawl_links` + +# command-line settings override config file settings +while [ -n "$1" ] ; do + case "$1" in + "--config-file") + shift + export config_file=$1 + ;; + "--no-checkout") + do_checkout="no" + ;; + "--oacs-only") + dotlrn="no" + ;; + # For backward compatibility I am keeping the --postgresql switch + # which overrides setting in config file + "--postgresql") + database="postgresql" + ;; + "--interactive") + interactive="yes" + ;; + "--help"|"-h") + echo "${usage}" + exit 0 + ;; + *) + echo "$0: option not recognized: ${i}" + echo "${usage}" + exit 1 + ;; + esac + + shift +done + +# If pre/post checkout scripts have been provided - check that they can +# be executed +pre_checkout_script=`get_config_param pre_checkout_script` +post_checkout_script=`get_config_param post_checkout_script` +if [ -n "$pre_checkout_script" ] && [ ! -x $pre_checkout_script ]; then + echo "The pre checkout script $pre_checkout_script does not exist or is not executable" + exit -1 +fi +if [ -n "$post_checkout_script" ] && [ ! -x $post_checkout_script ]; then + echo "The post checkout script $post_checkout_script does not exist or is not executable" + 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, dotlrn=$dotlrn, and database=$database." +prompt_continue $interactive + +# Take down the server +echo "$0: Taking down $serverroot at $(date)" +$stop_server_command +# Wait for the server to come down +echo "$0: Waiting $shutdown_seconds seconds for server to shut down at $(date)" +sleep $shutdown_seconds + +# Recreate the database user +echo "$0: Recreating database user at $(date)" +if [ $database == "postgres" ]; then + pg_bindir=`get_config_param pg_bindir` + 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 + su oracle -c "cd $script_path; config_file=$config_file ./oracle/recreate-user.sh"; +fi + +prompt_continue $interactive + +echo $do_checkout +# Move away the old sources and checkout new ones check do_checkout +if [ $dotlrn == "yes" ]; then + echo "$0: Checking out .LRN at $(date)" + config_file=$config_file dotlrn=$dotlrn ./checkout.sh + + # If we are using supervise - give group web permissions to control the server + if echo $start_server_command | grep -q "svc"; then + # 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 ${serverroot}" + # svgroup may not be on the system, check the PATH + if which svgroup &> /dev/null; then + svgroup web ${serverroot} + fi + fi +fi + +# Bring up the server again +echo "$0: Bringing the server $serverroot back up at $(date)" +$start_server_command +# Give the server some time to come up +echo "$0: Waiting for $startup_seconds seconds for server to come up at $(date)" +sleep $startup_seconds + +# Save the time we started installation +installation_start_time=$(date +%s) +# TODO - write this into a file somewhere + +# Install OpenACS +echo "$0: Starting installation of OpenACS at $(date)" +${tclwebtest_dir}/tclwebtest -config_file $config_file openacs-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 + +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)" + ${tclwebtest_dir}/tclwebtest -config_file $config_file dotlrn-links-check.test +fi + +# Report the time at which we were done +echo "$0: Finished (re)installing $serverroot at $(date)" + +# Check errors in the log file +if [ -r ${error_log_file} ]; then + seconds_since_installation_start=$(expr $(date +%s) - $installation_start_time) + minutes_since_installation_start=$(expr $seconds_since_installation_start / 60 + 1) + log_error_file=server-output/${server}/log-file-errors + ./aolserver-errors.pl -${minutes_since_installation_start}m ${error_log_file} > $log_error_file + error_line_count=$(wc -l $log_error_file | awk '{print $1}') + if expr $error_line_count \> 1 &> /dev/null; then + alert_keyword=`get_config_param alert_keyword` + echo "$0: ${alert_keyword} - There are error messages in the log file, they are stored in $log_error_file" + fi +else + echo "$0: Log file ${error_log_file} not readable - cannot check for errors" +fi + +# Warn about errors in the HTML returned from the server +./warn-if-installation-errors.sh `get_config_param openacs_output_file` +./warn-if-installation-errors.sh `get_config_param openacs_packages_output_file` +if [ $dotlrn == "yes" ]; then + ./warn-if-installation-errors.sh `get_config_param apm_output_file` +fi Index: openacs-4/etc/install/openacs-install.test =================================================================== RCS file: /usr/local/cvsroot/openacs-4/etc/install/openacs-install.test,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/etc/install/openacs-install.test 4 Sep 2003 16:51:26 -0000 1.1 @@ -0,0 +1,72 @@ +# Source procedures +source "tclwebtest-functions.tcl" + +# Test Execution START + +# Request the root page +do_request "$server_url" + +# Check that database connection is there and configuration is ok +assert ![regexp -nocase "At least one misconfiguration was discovered" "[response text]"] + +# Install the core data model and load the .info package files (took 155s) +do_request "$server_url/install-data-model" +write_response_to_file $openacs_output_file + +# Install the packages (took 73s) +do_request "$server_url/packages-install" +write_response_to_file $openacs_packages_output_file + +# Create an administrator +do_request "$server_url/create-administrator" + +field find ~f ~n email +field fill "$admin_email" + +field find ~f ~n "first_names" +field fill "$admin_first_names" + +field find ~f ~n last_name +field fill "$admin_last_name" + +field find ~n password +field fill "$admin_password" + +field find ~n password_confirmation +field fill "$admin_password" + +form submit + +# Fill in the system administration page +assert text "Please enter some information about your system" + +field find ~n system_url +field fill "$server_url" + +field find ~n system_name +field fill "$system_name" + +field find ~n publisher_name +field fill "$publisher_name" + +field find ~n system_owner +field fill "$system_owner_email" + +field find ~n admin_owner +field fill "$admin_owner_email" + +field find ~n host_administrator +field fill "$admin_owner_email" + +field find ~n outgoing_sender +field fill "$outgoing_sender_email" + +field find ~n new_registrations +field fill "$new_registrations_email" + +form submit + +# Installation should now be done +assert text "OpenACS Installation Complete" + +# Test Execution END Index: openacs-4/etc/install/post-checkout-script.sh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/etc/install/post-checkout-script.sh,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/etc/install/post-checkout-script.sh 4 Sep 2003 16:51:26 -0000 1.1 @@ -0,0 +1,3 @@ +#!/bin/sh + +# placeholder \ No newline at end of file Index: openacs-4/etc/install/ref-timezones-data.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/etc/install/ref-timezones-data.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/etc/install/ref-timezones-data.sql 4 Sep 2003 16:51:26 -0000 1.1 @@ -0,0 +1,8 @@ +-- packages/ref-timezones/sql/oracle/ref-timezone-data.sql +-- +-- Part of the timezone reference data +-- +-- @cvs-id $Id: ref-timezones-data.sql,v 1.1 2003/09/04 16:51:26 joela Exp $ + +insert into timezones values (1,'Africa/Abidjan','+000000'); +insert into timezones values (2,'Africa/Accra','+000000'); Index: openacs-4/etc/install/ref-timezones-rules.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/etc/install/ref-timezones-rules.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/etc/install/ref-timezones-rules.sql 4 Sep 2003 16:51:26 -0000 1.1 @@ -0,0 +1,30 @@ +-- packages/ref-timezones/sql//common/ref-timezones-rules.sql +-- +-- This file is generated automatically based on the Unix timezone +-- database. It defines each time range during which a particular +-- local-to-UTC conversion rule is in effect. The rules specification +-- is of the form: +-- +-- where +-- +-- tz is the Unix timezone name +-- abbrev is an abbreviation for the conversion rule, +-- isdist is the Daylight Savings Time flag +-- gmt_offset is the difference between local time and UTC in seconds +-- utc_[start,end] are the UTC times during which the rule applies +-- local_[start,end] are the local times during which this rule applies. +-- +-- Note that local times are discontinuous because of DST transitions. +-- +-- Rules in general run until 2038. +-- +-- @author Jon Griffin (jon@jongriffin.com) +-- +-- @created 2000-12-04 +-- +-- $Id: ref-timezones-rules.sql,v 1.1 2003/09/04 16:51:26 joela Exp $ + +insert into timezone_rules values (1,'GMT',rdbms_date('Dec 14 1901 08:45:52'),rdbms_date('Jan 01 1912 12:16:07'),rdbms_date('Dec 14 1901 08:29:44'),rdbms_date('Dec 31 1911 11:59:59'),-968,'f'); +insert into timezone_rules values (1,'GMT',rdbms_date('Jan 01 1912 12:16:08'),rdbms_date('Jan 18 2038 03:14:07'),rdbms_date('Jan 01 1912 12:16:08'),rdbms_date('Jan 18 2038 03:14:07'),0,'f'); +insert into timezone_rules values (2,'GMT',rdbms_date('Dec 14 1901 08:45:52'),rdbms_date('Jan 01 1918 12:00:51'),rdbms_date('Dec 14 1901 08:45:00'),rdbms_date('Dec 31 1917 11:59:59'),-52,'f'); +insert into timezone_rules values (2,'GMT',rdbms_date('Jan 01 1918 12:00:52'),rdbms_date('Aug 31 1936 11:59:59'),rdbms_date('Jan 01 1918 12:00:52'),rdbms_date('Aug 31 1936 11:59:59'),0,'f'); Index: openacs-4/etc/install/tclwebtest-functions.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/etc/install/Attic/tclwebtest-functions.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/etc/install/tclwebtest-functions.tcl 4 Sep 2003 16:51:26 -0000 1.1 @@ -0,0 +1,871 @@ +# Initialize global variables +global __server_url +set __server_url $server_url +global __admin_last_name +set __admin_last_name $admin_last_name +global __admin_email +set __admin_email $admin_email +global __admin_password +set __admin_password $admin_password +global __url_history +set __url_history [list] +global __demo_users_password +if { [info exists demo_users_password] } { + set __demo_users_password $demo_users_password +} else { + set __demo_users_password "guest" +} +global __dotlrn_users_data_file +if { [info exists dotlrn_users_data_file] } { + set __dotlrn_users_data_file $dotlrn_users_data_file +} else { + set __dotlrn_users_data_file users-data.csv +} + +# Extracted from OpenACS for generating random numbers +# This is really over kill. I will use the Tcl builtin +# expr rand() instead +proc randomInit {seed} { + global __random + + array set __random {} + + set __random(ia) 9301 + set __random(ic) 49297 + set __random(im) 233280 + set __random(seed) $seed +} + +randomInit [clock seconds] + +proc random {} { + global __random + + set __random(seed) [expr ($__random(seed) * $__random(ia) + $__random(ic)) % $__random(im)] + + return [expr $__random(seed)/double($__random(im))] +} + +proc randomRange {range} { + +# return [expr int([random] * $range)] + return [expr int([expr rand()] * $range)] +} + +proc get_random_items_from_list { list number } { + + # Build a list of indices + set index_list [list] + for { set i 0 } { $i < [llength $list] } { incr i } { + lappend index_list $i + } + + # If the list was empty - return + if { [llength $index_list] == 0 } { + return {} + } + + # Cannot return more items than are in the list + if { $number > [llength $list] } { + error "get_random_items_from_list: cannot return $number items from list $list" + } + + # Pick number random indices from the list. Remove each index that we have + # already picked. + set random_indices [list] + for { set index_count 0 } { $index_count < $number } { incr index_count } { + set random_index [randomRange [llength $index_list]] + + lappend random_indices [lindex $index_list $random_index] + + # Remove the index that we picked + set index_list [lreplace $index_list $random_index $random_index] + } + + # Build and return the items at the random indices + set return_list [list] + foreach index $random_indices { + lappend return_list [lindex $list $index] + } + if { [llength $return_list] == 1 } { + return [lindex $return_list 0] + } else { + return $return_list + } +} + +proc write_response_to_file { filename } { + + # Create the directory of the output file if it doesn't exist + if { ![file isdirectory [file dirname $filename]] } { + exec mkdir -p [file dirname $filename] + } + set file_id [open "$filename" w+] + puts $file_id "[response body]" +} + +# Start User data +ad_proc get_users_emails { {type ""} } { + set user_emails [list] + + foreach user_data [get_users_data] { + if { [empty_string_p $type] || \ + [string equal -nocase [lindex $user_data 4] $type] } { + + lappend user_emails [lindex $user_data 2] + } + } + + return $user_emails +} + +proc get_random_users_of_type { type number } { + set email_list [get_users_emails $type] + + return [get_random_items_from_list $email_list $number] +} + +proc get_user_password { email } { + global __demo_users_password + + return $__demo_users_password +} +# End user data + +proc engineering_class_p { class_url } { + + return [regexp {dotlrn/classes/(computer-science|mathematics)} $class_url match] +} + +proc follow_class_members_link {} { + + link follow ~u {members$} +} + +proc get_professor_for_class { class_url } { + + # TODO: find the professor of the class + follow_class_members_link + + # This is fragile... + # TODO regexping on HTML code is too fragile + # write special pages that export such data instead + + return [get_random_users_of_type professor 1] +} + +proc login_user { user_email user_password} { + + logout_user + + global __server_url + + # Request the start page + do_request "$__server_url" + + # Login the user + form find ~n login + field find ~n username + field fill "$user_email" + field find ~n password + field fill "$user_password" + form submit +} + +proc logout_user {} { + global __server_url + + do_request "${__server_url}/register/logout" +} + +proc login_site_wide_admin {} { + global __server_url + global __admin_email + global __admin_password + + login_user $__admin_email $__admin_password +} + +proc install_all_packages { server_url } { + + do_request "$server_url/acs-admin/apm/packages-install?checked_by_default_p=1" + #assert text "Package Installation" + # If there are no new packages to install, just return + if { [regexp -nocase {no new packages to install} [response body] match] } { + return + } + + form submit + + # Sometimes there are failed dependencies for certain packages + # In this case we ignore those packages and continue + if { [regexp {.*packages-install-2} "$::tclwebtest::url" match]} { + form submit + } + + #assert text "Select Data Model Scripts to Run" + # Source SQL scripts (took 68s) + form submit +} + +proc add_main_site_folder { server_url folder_name } { + + do_request "$server_url/admin/site-map" + + link follow ~c "new sub folder" + form find ~a new + field find ~n name + field fill "$folder_name" + form submit +} + +proc mount_main_site_package { server_url folder_name instance_name package_key } { + + do_request "$server_url/admin/site-map" + + # Follow the link to add a new application at the first matching folder name + link find ~c $folder_name + link follow ~c "new application" + + # Add the package instance + form find ~a "package-new" + field find ~n instance_name + field fill "$instance_name" + # package_key + field select "$package_key" + form submit +} + +# FIXME: This proc is very vulnerable since the parameter-set form in +# the site-map uses parameter_id to identify parameters +proc submit_acs_param_internal { old_parameter_value new_parameter_value } { + + form find ~a "parameter-set-2" + field find ~v "$old_parameter_value" + field fill "$new_parameter_value" + form submit +} + +proc set_acs_subsite_param { server_url old_parameter_value parameter_value } { + + do_request "$server_url/admin/site-map" + link follow ~u {parameter-set\?package%5fid=[0-9]+&package%5fkey=acs%2dsubsite&instance%5fname=Main%20Site} + + submit_acs_param_internal $old_parameter_value $parameter_value +} + +proc set_acs_kernel_param { server_url param_section old_parameter_value parameter_value } { + + do_request "$server_url/admin/site-map" + link follow ~u {parameter-set\?package%5fid=[0-9]+&package%5fkey=acs%2dkernel} + + if { ![string equal $param_section "acs-kernel"] } { + link follow ~c "$param_section" + } + + submit_acs_param_internal $old_parameter_value $parameter_value +} + +proc add_user { + server_url + first_names + last_name + email + id + type + full_access + guest +} { + do_request "$server_url/dotlrn/admin/users" + link follow ~u "user-add" + + form find ~a "/dotlrn/user-add" + field find ~n "id" + field fill $id + field find ~n "email" + field fill $email + field find ~n "first_names" + field fill $first_names + field find ~n "last_name" + field fill $last_name + form submit + + form find ~n add_user + field find ~n "id" + field select $type + + # FIXME: TclWebTest chooses option based on label rather than value + # Full Access or Limited Access + field select $full_access + # Yes or No + field select $guest + form submit +} + +proc get_users_data {} { + + # Let's cache the data + global __users_data + + if { [info exists __users_data] } { + return $__users_data + } + + global __dotlrn_users_data_file + + set file_id [open "$__dotlrn_users_data_file" r] + set file_contents [read -nonewline $file_id] + set file_lines_list [split $file_contents "\n"] + + set return_list [list] + + foreach line $file_lines_list { + set fields_list [split $line ","] + + # Allow commenting of lines with hash + if { ![regexp {\#.+} "[string trim [lindex $fields_list 0]]" match] } { + + # FIXME: TclWebTest chooses option based on label rather than value + # This is a workaround that converts values to labels + if { [string trim [lindex $fields_list 5]] == "1" } { + set full_access "Full Access" + } else { + set full_access "Limited Access" + } + if { [string trim [lindex $fields_list 6]] == "t" } { + set guest "Yes" + } else { + set guest "No" + } + set type [string trim [lindex $fields_list 4]] + if { $type == "admin" } { + set type "Staff" + } + + lappend return_list [list \ + [string trim [lindex $fields_list 0]] \ + [string trim [lindex $fields_list 1]] \ + [string trim [lindex $fields_list 2]] \ + [string trim [lindex $fields_list 3]] \ + $type \ + $full_access \ + $guest] + + } + } + + set __users_data $return_list + + return $return_list +} + +proc upload_users { server_url } { + +# File upload +# Does not work - TclWebTest does not support file upload yet +# do_request "$server_url/dotlrn/admin/users-bulk-upload" + +# form find ~a "users-bulk-upload-2" +# field find ~n "users_csv_file" +# field fill "$users_csv_file" +# form submit + + set users_data_list [get_users_data] + + foreach user_data $users_data_list { + + add_user $server_url \ + [lindex $user_data 0] \ + [lindex $user_data 1] \ + [lindex $user_data 2] \ + [lindex $user_data 3] \ + [lindex $user_data 4] \ + [lindex $user_data 5] \ + [lindex $user_data 6] + + } +} + +proc set_users_passwords { server_url } { + + foreach user_email [get_users_emails] { + #puts "setting guest password for user $user_email" + + # User admin page + do_request "${server_url}/dotlrn/admin/users" + + form find ~a "users-search" + field fill $user_email ~n name + form submit + + # User workspace + link follow ~u {user\?} + + # change password + link follow ~u {password-update\?} + + form find ~a password-update-2 + field fill [get_user_password $user_email] ~n password_1 + field fill [get_user_password $user_email] ~n password_2 + form submit + } +} + +proc add_term { server_url term_name start_month start_year end_month end_year } { + + do_request "$server_url/dotlrn/admin/term-new" + form find ~n add_term + field find ~n "term_name" + + field fill "$term_name" + # Start date + field select $start_month + field select "01" + field find ~n "start_date.year" + field fill $start_year + # End date + field select $end_month + field select "01" + field find ~n "end_date.year" + field fill $end_year + form submit +} + +proc setup_terms { server_url } { + + add_term $server_url "Fall" "September" "2003" "January" "2004" + add_term $server_url "Spring" "January" "2004" "July" "2004" + add_term $server_url "Fall" "September" "2004" "January" "2005" +} + +proc add_department { server_url pretty_name description external_url } { + + do_request "$server_url/dotlrn/admin/department-new" + form find ~n add_department + field find ~n "pretty_name" + field fill $pretty_name + field find ~n "description" + field fill $description + field find ~n "external_url" + field fill $external_url + + form submit +} + +proc setup_departments { server_url } { + + add_department $server_url "Mathematics" \ + "The Faculty of Mathematics consists of the Department of Applied Mathematics & Theoretical Physics (DAMTP) and the Department of Pure Mathematics & Mathematical Statistics (DPMMS). The Statistical Laboratory is a sub-department of the DPMMS. Also located within the University of Cambridge is the Isaac Newton Institute for Mathematical Sciences." \ + "http://www.maths.cam.ac.uk/" + + add_department $server_url "Computer Science" \ + "The Computer Laboratory is the Computer Science department of the University of Cambridge. The University Computing Service has a separate set of web pages." \ + "http://www.cl.cam.ac.uk/" + + add_department $server_url "Architecture" \ + "Because of the great diversity of offerings in the College of Environmental Design and in the Department of Architecture in areas such as building environments, practice of design, design methods, structures and construction, history, social and cultural factors in design, and design itself, it is possible to obtain either a very broad and general foundation or to concentrate in one or several areas." \ + "http://arch.ced.berkeley.edu/" + + add_department $server_url "Business Administration" \ + "The department offers a range of courses in Business Administration, Finance, and Law" \ + "http://mitsloan.mit.edu/" +} + +proc add_subject { server_url department_pretty_name pretty_name description } { + + do_request "$server_url/dotlrn/admin/class-new" + + form find ~n add_class + field find ~n "form:id" + field select "$department_pretty_name" + field find ~n "pretty_name" + field fill $pretty_name + field find ~n "description" + field fill $description + + form submit +} + +proc setup_subjects { server_url } { + + # Mathematics Department + add_subject $server_url "Mathematics" "Differential Geometry" " An introduction to differential geometry with applications to general relativity. Metrics, Lie bracket, connections, geodesics, tensors, intrinsic and extrinsic curvature are studied on abstractly defined manifolds using coordinate charts. Curves and surfaces in three dimensions are studied as important special cases. Gauss-Bonnet theorem for surfaces and selected introductory topics in special and general relativity are also studied. 18.100 is required, 18.101 is strongly recommended, and 18.901 would be helpful." + + # Computer Science department + add_subject $server_url "Computer Science" "Peer to Peer Computing" "The term peer-to-peer (P2P) refers to a class of systems and applications that employ distributed resources to perform a critical function in a decentralized manner..." + + add_subject $server_url "Computer Science" "Advanced Topics in Programming Languages" "This course focuses on bioinformatics applications, high-performance computing, and the application of high-performance computing to bioinformatics applications." + + add_subject $server_url "Computer Science" "Computer and Network Security" "This class serves as an introduction to information systems security and covers security issues at an undergraduate level" + + # Architecture Department + add_subject $server_url "Architecture" "Architecture and Culture" "Selected examples of architecture and interior design are used as case studies to illustrate the presence of ideas in built matter. A range of projects are analysed and discussed in terms of the conceptual qualities that underpin the physical manifestations of architecture and interior design." + + # Business Administration Department + add_subject $server_url "Business Administration" "Economic Analysis for Business Decisions" " Introduces students to principles of microeconomic analysis used in managerial decision making. Topics include demand analysis, cost and production functions, the behavior of competitive and non-competitive markets, sources and uses of market power, and game theory and competitive strategy, with applications to various business and public policy decisions. Antitrust policy and other government regulations are also discussed. 15.010 restricted to first-year Sloan masters students. 15.011 primarily for non-Sloan School students." + + add_subject $server_url "Business Administration" "Organizational Psychology & Sociology" "Organizations are changing rapidly. To deal with these changes requires new skills and attitudes on the part of managers. The goal of the OPS course is to make you aware of this challenge and equip you to better meet it. In short, the purpose is to acquaint you with some of psychological and sociological phenomena that regularly occur in organizations - the less visible forces that influence employee and managerial behavior. The aim is to increase your understanding of these forces -- in yourself and in others -- so that as they become more visible, they become manageable (more or less) and hence subject to analysis and choice." + + add_subject $server_url "Business Administration" "Advanced Corporate Finance" "The primary objective of the advanced corporate finance course is to conduct an in-depth analysis of special topics of interest to corporate finance managers. Our attempt will be to obtain a detailed understanding of the motives and reasons that lead to certain corporate decisions specifically in relation to the following issues: Mergers and Acquisitions, Corporate Restructurings, Corporate Bankruptcy, Corporate Governance" +} + +proc get_class_add_urls_foreach_subject { server_url } { + + return [get_list_of_urls_from_links $server_url "$server_url/dotlrn/admin/classes" "class-instance-new"] +} + +proc get_list_of_urls_from_links { server_url page_url link_url_pattern } { + + do_request "$page_url" + + set urls_list [list] + + # Loop over and add all links + set errno "0" + while { $errno == "0" } { + set errno [catch { + array set link_array [link find -next ~u "$link_url_pattern"]} error] + + if { [string equal $errno "0"] } { + set url $link_array(url) + + if { [regexp {http://} $url match] } { + # Fully qualified URL + lappend urls_list $url + } elseif { [string index $url 0] == "/" } { + # Absolute path + lappend urls_list ${server_url}${url} + } else { + # Relative path + regexp {(http://[^?]+/)} $page_url match dir_url + lappend urls_list ${dir_url}${url} + } + } + } + + + return $urls_list +} + +proc get_class_admin_urls { server_url term_pretty_name } { + set admin_url_base "$server_url/dotlrn/admin/term" + set admin_url_no_term "${admin_url_base}?term_id=-1" + + # First extract the term_id corresponding to the term_pretty_name + do_request $admin_url_no_term + form find ~n term_form + field find ~n term_id + field select $term_pretty_name + array set term_select_field [field current] + set term_id $term_select_field(value) + + set admin_url_term "${admin_url_base}?term_id=$term_id" + + return [get_list_of_urls_from_links $server_url $admin_url_term {/dotlrn/classes/.*/one-community-admin$}] +} + +proc setup_classes { server_url } { + + setup_classes_for_term $server_url "Fall 2003/2004" + setup_classes_for_term $server_url "Spring 2004" +} + +proc setup_classes_for_term { server_url term_name } { + + foreach link [get_class_add_urls_foreach_subject $server_url] { + + do_request $link + form find ~n "add_class_instance" + field find + field select $term_name + field find ~n pretty_name + array set name_field [field current] + set pretty_name $name_field(value) + field fill "$pretty_name $term_name" + form submit + } +} + +proc setup_class_memberships { server_url } { + + foreach admin_url [get_class_admin_urls $server_url "Fall 2003/2004"] { + + # Admin page for the class + do_request "$admin_url" + + # Member management for the class + follow_class_members_link + + # Add all students + add_class_members [get_users_emails student] "Student" + + # Add a random professor + add_class_member [get_random_users_of_type professor 1] "Professor" + + # Add two random staff + set admin_users [get_random_users_of_type staff 2] + set admin_labels [list "Course Assistant" "Teaching Assistant"] + set admin_counter 0 + for { set admin_counter 0 } \ + { [expr $admin_counter < 2 && $admin_counter < [llength $admin_users]] } \ + { incr admin_counter } { + + set admin_label [get_random_items_from_list $admin_labels 1] + add_class_member [lindex $admin_users $admin_counter] $admin_label + } + } +} + +proc setup_class_subgroups { server_url } { + + foreach admin_url [get_class_admin_urls $server_url "Fall 2003/2004"] { + + foreach {name description policy} [subcommunity_properties_list] { + + # Admin page of one class + do_request $admin_url + + # Add subcommunity form + link follow ~u subcommunity-new + + form find ~n add_subcomm + field fill $name ~n pretty_name + field fill $description ~n description + field find ~n join_policy + field select $policy + form submit + } + } +} + +proc add_default_class_forums { server_url } { + + foreach admin_url [get_class_admin_urls $server_url "Fall 2003/2004"] { + + # Admin page of one class + do_request $admin_url + + # Add forum form + link follow ~u forum-new + + form find ~n forum + field fill "This is a general discussion forum where teachers, assistants, and students can come together to discuss the subject of the class or practical matters surrounding exams, assignments, project work etc." ~n charter + form submit + } +} + +proc add_member_applet_to_classes { server_url } { + + foreach admin_url [get_class_admin_urls $server_url "Fall 2003/2004"] { + + # Only add the members applet to computing classes so that we can + # demo adding it to other classes manually + if { [regexp -nocase {comput} $admin_url match] } { + + # Admin page of the class + do_request $admin_url + + # Manage Applets + link follow ~u {applets$} + + # Add the Members Info applet + link follow ~u {applet-add.*applet_key=dotlrn_members} + } + } +} + +proc add_class_news_items { server_url } { + + set news_item_list [get_news_items] + + set class_counter 0 + foreach admin_url [get_class_admin_urls $server_url "Fall 2003/2004"] { + + # We want the professor of the class to post the news item + # TODO + #set email [get_professor_for_class $admin_url] + #login_user $email [get_user_password $email] + + # Admin page of the class + do_request $admin_url + + # News item add + link follow ~u {news/+item-create} + + set news_item [get_random_news_item $news_item_list $class_counter] + + form find ~a preview + set publish_title [lindex $news_item 0] + set publish_body [lindex $news_item 1] + field fill $publish_title ~n publish_title + field fill $publish_body ~n publish_body + field check ~n permanent_p + form submit + + # confirm + form find ~a {item-create-3} + + form submit + + incr class_counter + } + + # Re-login the site-wide admin + login_site_wide_admin +} + +proc get_random_news_item { news_list counter } { + + set item_index [expr $counter % [llength $news_list]] + + return [lindex $news_list $item_index] +} + +proc get_news_items {} { + + set news_item_list [list] + + lappend news_item_list {{The exam is postponed by one week} {The final exam previously planned for the 20:th of December will be on the 3:d of January instead - the calendar has been updated}} + + lappend news_item_list {{Recommended Reading for friday workshop} {For the friday workshop reading up on chapter three of the course materials is strongly recommended. See you on friday!}} + + lappend news_item_list {{Class Assistants Needed} {We need more people to assist with the seminar on tuesday - let me know if you are interested!}} + + lappend news_item_list {{Changed Schedule} {We have decided to adjust the schedule slightly by moving section 6 and 8 of the of the text book to be treated in december.}} + + lappend news_item_list {{Deadline for assignment II on thursday} {We need to have the homework assignments handed in for review no later than this thursday}} + + lappend news_item_list {{Project Group Meeting} {We will hold an extra project group meeting on next wednesday to plan and discuss the various topics that have been suggested.}} + + return $news_item_list +} + +proc subcommunity_properties_list {} { + + set property_list [list] + + foreach letter {A B} { + set pretty_name "Project Group $letter" + lappend property_list $pretty_name + lappend property_list "Workspace for people working in $pretty_name" + lappend property_list "Needs Approval" + } + + return $property_list +} + +proc add_class_members { email_list role } { + foreach email $email_list { + add_class_member $email $role + } +} + +proc add_class_member { email role } { + + if { [empty_string_p $email] } { + return + } + + # Search for the student to add + form find ~a member-add + field find ~n search_text + field fill $email + form submit + + # Pick the user (there should be only one) + link follow ~u member-add-2 + + # add as student (default) + form find ~a "member-add-3" + + field find ~n rel_type + field select $role + form submit +} + +proc setup_communities { server_url } { + + add_community $server_url "Tennis Club" "Community for the university tennis club with tournaments and other events, also helps you find people to play with." "Open" + add_community $server_url "Business Alumni Class of 1997" "Alumni community for the Business Administration graduates from the class of 1997." "Closed" + add_community $server_url "Business Administration Program" "Community for all students following the Business Administration Program" "Closed" + add_community $server_url "Star Trek Fan Club" "Community for die-hard fans of Star Trek" "Needs Approval" +} + +proc add_community { server_url name description policy } { + + do_request "${server_url}/dotlrn/admin/club-new" + + form find ~n add_club + + field find ~n pretty_name + field fill $name + field find ~n description + field fill $description + field find ~n join_policy + field select $policy + + form submit +} + +proc add_site_wide_admin_to_dotlrn { server_url } { + + global __admin_last_name + + # Goto users page + do_request "$server_url/dotlrn/admin/users?type=pending" + + # Goto the community page for the site-wide admin (__admin_last_name) + link follow ~c $__admin_last_name + + # Follow the add to dotlrn link + link follow ~u "user-new-2" + + # Use defaults (external with full access) + form find ~a "user-new-2" + form submit +} + +proc crawl_links {} { + + global __url_history + + set start_url [lindex $__url_history end] + + # Return if given start URL is external + global __server_url + set absolute_url [tclwebtest::absolute_link $start_url] + if { [string first $__server_url $absolute_url] == -1 } { + #puts "not following link to external url $absolute_url" + return + } + + # Also return if this is the logout link + if { [regexp {/register/logout} $start_url match] } { + #puts "not following logout link" + return + } + + do_request $start_url + + set errno 0 + while { $errno == "0" } { + set errno [catch { + array set link_array [link find -next]} error] + + if { [string equal $errno "0"] } { + set url $link_array(url) + + # Don't revisit URL:s we have already tested + # Don't follow relative anchors on pages - can't get them to work with TclWebtest + if { [lsearch -exact $__url_history $url] == -1 && [string range $url 0 0] != "#" } { + #puts "$start_url following url $url" + + lappend __url_history $url + + crawl_links + } else { + #puts "$start_url skipping url $url as visited before" + } + } + } +} Index: openacs-4/etc/install/users-data.csv =================================================================== RCS file: /usr/local/cvsroot/openacs-4/etc/install/users-data.csv,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/etc/install/users-data.csv 4 Sep 2003 16:51:26 -0000 1.1 @@ -0,0 +1,15 @@ +Albert,Smidth,albert_smidth@dotlrn.test,,student,1,f +John,White,john_white@dotlrn.test,,student,1,f +Samuel, Williamson, samuel_williamson@dotlrn.test,,student,1,f +Tracy, Hill, tracy_hill@dotlrn.test,,student,1,f +Katharina, Cohen, katharina_cohen@dotlrn.test,,student,1,f +Mikael, Hansson, mikael_hansson@dotlrn.test,,student,1,f +Andreas, Svensson, andreas_svensson@dotlrn.test,,student,1,f +Amanda,Edmonds,amanda_edmonds@dotlrn.test,,professor,1,f +John,Cameron,john_cameron@dotlrn.test,,professor,1,f +Albert,Einstein,albert_einstein@dotlrn.test,,admin,1,f +Marie,Curie,marie_curie@dotlrn.test,,admin,1,f +Niels,Bohr,niels_bohr@dotlrn.test,,admin,1,f +Bertrand,Russel,bertrand_russel@dotlrn.test,,admin,1,f +Isaac,Newton,isaac_newton@dotlrn.test,,admin,1,f +Adam,Nowak,adam_nowak@dotlrn.test,,external,0,t Index: openacs-4/etc/install/warn-if-installation-errors.sh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/etc/install/warn-if-installation-errors.sh,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/etc/install/warn-if-installation-errors.sh 4 Sep 2003 16:51:26 -0000 1.1 @@ -0,0 +1,21 @@ +#!/bin/sh +# +# Relies on environment variables: +# config_file + +# Make script dir current dir for convenience +script_path=$(dirname $(which $0)) +cd $script_path + +file_name=$1 + +source functions.sh + +alert_keyword=`get_config_param alert_keyword` + +installation_errors=`./check-errors-output.sh $file_name` + +if echo $installation_errors | grep -q -i '[a-z]' ; then + echo "${alert_keyword}: There are potential installation errors. The file $file_name contains the following lines that suggest errors:" + echo "$installation_errors" +fi