Index: openacs-4/packages/acs-bootstrap-installer/installer.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-bootstrap-installer/installer.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/acs-bootstrap-installer/installer.tcl 25 Aug 2003 11:55:40 -0000 1.9 +++ openacs-4/packages/acs-bootstrap-installer/installer.tcl 10 Oct 2003 14:52:16 -0000 1.10 @@ -204,7 +204,258 @@ } } +ad_proc -private install_do_data_model_install {} { + Installs the kernel datamodel. +} { + ns_write " + Installing the OpenACS kernel data model... +
+ + Done installing the OpenACS kernel data model.+ " + cd [file join [acs_root_dir] packages acs-kernel sql [db_type]] + db_source_sql_file -callback apm_ns_write_callback acs-kernel-create.sql + # DRB: Now initialize the APM's table of known database types. This is + # butt-ugly. We could have apm-create.sql do this but that would mean + # adding a new database type would require editing two places (the very + # obvious list in bootstrap.tcl and the less-obvious list in apm-create.sql). + # On the other hand, this is ugly because now this code knows about the + # apm datamodel as well as the existence of the special acs-kernel module. + + set apm_db_types_exists [db_string db_types_exists " + select case when count(*) = 0 then 0 else 1 end from apm_package_db_types"] + + if { !$apm_db_types_exists } { + ns_log Notice "Populating apm_package_db_types" + foreach known_db_type [db_known_database_types] { + set db_type [lindex $known_db_type 0] + set db_pretty_name [lindex $known_db_type 2] + db_dml insert_apm_db_type { + insert into apm_package_db_types + (db_type_key, pretty_db_name) + values + (:db_type, :db_pretty_name) + } + } + } + + ns_write "
+ + " + + # Some APM procedures use util_memoize, so initialize the cache + # before starting APM install + apm_source "[acs_package_root_dir acs-tcl]/tcl/20-memoize-init.tcl" + + apm_version_enable -callback apm_ns_write_callback [apm_package_install -callback apm_ns_write_callback "[file join [acs_root_dir] packages acs-kernel acs-kernel.info]"] + + ns_write "
Loading package .info files.
" + + # Preload all the .info files so the next page is snappy. + apm_dependency_check -initial_install [apm_scan_packages -new [file join [acs_root_dir] packages]] + + ns_write "Done loading package .info files
" +} + +ad_proc -private install_do_packages_install {} { + Installs all packages during OpenACS install. +} { + proc ad_acs_kernel_id {} { + if {[db_table_exists apm_packages]} { + return [db_string acs_kernel_id_get { + select package_id from apm_packages + where package_key = 'acs-kernel' + } -default 0] + } else { + return 0 + } + } + + ns_write "Installing OpenACS Core Services" + + # Load the acs-tcl init files that might be needed when installing, instantiating and mounting packages + # We shouldn't source request-processor-init.tcl as it might interfere with the installer request handler + foreach { init_file } { utilities-init.tcl site-nodes-init.tcl } { + ns_log Notice "Loading acs-tcl init file $init_file" + apm_source "[acs_package_root_dir acs-tcl]/tcl/$init_file" + } + apm_bootstrap_load_libraries -procs acs-subsite + apm_bootstrap_load_queries acs-subsite + install_redefine_ad_conn + + # Attempt to install all packages. + set dependency_results [apm_dependency_check -initial_install [apm_scan_packages -new [file join [acs_root_dir] packages]]] + set dependencies_satisfied_p [lindex $dependency_results 0] + set pkg_list [lindex $dependency_results 1] + apm_packages_full_install -callback apm_ns_write_callback $pkg_list + + # Complete the initial install. + + if { ![ad_acs_admin_node] } { + ns_write "
+
" + + # Now process the application bundle if an install.xml file was found. + + if { [file exists [apm_install_xml_file_path]] } { + set root_node [apm_load_install_xml_file] + + ns_write "" + + # Mount the main site + cd [file join [acs_root_dir] packages acs-kernel sql [db_type]] + db_source_sql_file -callback apm_ns_write_callback acs-install.sql + + # Make sure the site-node cache is updated with the main site + site_node::init_cache + + # We need to redefine ad_conn again since apm_package_install resourced the real ad_conn + install_redefine_ad_conn + + # Mount and set permissions for core packages + apm_mount_core_packages + + ns_write "
Loading packages for the [nsv_get acs_application pretty_name] application.
" + + set actions [xml_node_get_children_by_name $root_node actions] + if { [llength $actions] > 1 } { + ns_log Error "Error in \"install.xml\": only one action node is allowed" + ns_write "Error in \"install.xml\": only one action node is allowed
"
+ return
+ }
+ set actions [xml_node_get_children [lindex $actions 0]]
+
+ foreach action $actions {
+
+ switch -exact [xml_node_get_name $action] {
+
+ text {}
+
+ install {
+
+ set install_spec_files [list]
+ foreach install_spec_file \
+ [glob -nocomplain "[acs_root_dir]/packages/[apm_required_attribute_value $action package]/*.info"] {
+ if { [catch { array set package [apm_read_package_info_file $install_spec_file] } errmsg] } {
+ # Unable to parse specification file.
+ ns_log Error "$install_spec_file could not be parsed correctly. The error: $errmsg"
+ ns_write "
install: $install_spec_file could not be parsed correctly. The error: $errmsg"
+ return
+ }
+ if { [apm_package_supports_rdbms_p -package_key $package(package.key)] &&
+ ![apm_package_installed_p $package(package.key)] } {
+ lappend install_spec_files $install_spec_file
+ }
+ }
+
+ set pkg_info_list [list]
+ foreach spec_file [glob -nocomplain "[acs_root_dir]/packages/*/*.info"] {
+ # Get package info, and find out if this is a package we should install
+ if { [catch { array set package [apm_read_package_info_file $spec_file] } errmsg] } {
+ # Unable to parse specification file.
+ ns_log Error "$spec_file could not be parsed correctly. The error: $errmsg"
+ ns_write "
install: $spec_file could not be parsed correctly. The error: $errmsg"
+ return
+ }
+
+ if { [apm_package_supports_rdbms_p -package_key $package(package.key)] &&
+ ![apm_package_installed_p $package(package.key)] } {
+ # Save the package info, we may need it for dependency satisfaction later
+ lappend pkg_info_list [pkg_info_new $package(package.key) $spec_file \
+ $package(provides) $package(requires) ""]
+ }
+ }
+
+ if { [llength $install_spec_files] > 0 } {
+ set dependency_results [apm_dependency_check -pkg_info_all $pkg_info_list $install_spec_files]
+ if { [lindex $dependency_results 0] == 1 } {
+ apm_packages_full_install -callback apm_ns_write_callback [lindex $dependency_results 1]
+ } else {
+ foreach package_spec [lindex $dependency_results 1] {
+ if { [string is false [pkg_info_dependency_p $package_spec]] } {
+ ns_log Error "install: package \"[pkg_info_key $package_spec]\"[join [pkg_info_comment $package_spec] ","]"
+ append html "
Package \"[pkg_info_key $package_spec]\"\n
Mounting new instance of package $package_key at /$mount_point
"
+ site_node::instantiate_and_mount \
+ -node_id $node_id \
+ -node_name $mount_point \
+ -package_name $instance_name \
+ -package_key $package_key
+
+ }
+
+ }
+
+ set-parameter {
+ set name [apm_required_attribute_value $action name]
+ set value [apm_required_attribute_value $action value]
+ set package_key [apm_attribute_value -default "" $action package]
+ set url [apm_attribute_value -default "" $action url]
+
+ if { ![string equal $package_key ""] && ![string equal $url ""] } {
+ ns_log Error "set-parameter: Can't specify both package and url"
+ ns_write "
set-parameter: Can't specify both package and url"
+ return
+ } elseif { ![string equal $package_key ""] } {
+ parameter::set_from_package_key -package_key $package_key -parameter $name -value $value
+ } else {
+ parameter::set_value \
+ -package_id [site_node::get_object_id -node_id [site_node::get_node_id -url $url]] \
+ -parameter $name \
+ -value $value
+ }
+ }
+
+ default {
+ ns_log Error "Error in \"install.xml\": got bad node \"[xml_node_get_name $action]\""
+ }
+
+ }
+
+ }
+ }
+ }
+
+
+ ns_write "All Packages Installed."
+}
+
# Register the install handler.
ns_register_filter preauth GET * install_handler
ns_register_filter preauth POST * install_handler
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/acs-bootstrap-installer/installer/auto-install-oracle.xql'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/acs-bootstrap-installer/installer/auto-install-postgresql.xql'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.8 refers to a dead (removed) revision in file `openacs-4/packages/acs-bootstrap-installer/installer/auto-install.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/acs-bootstrap-installer/installer/auto-install.xql'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.8 refers to a dead (removed) revision in file `openacs-4/packages/acs-bootstrap-installer/installer/create-administrator-2.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/acs-bootstrap-installer/installer/create-administrator-postgresql.xql'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.5 refers to a dead (removed) revision in file `openacs-4/packages/acs-bootstrap-installer/installer/create-administrator.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Index: openacs-4/packages/acs-bootstrap-installer/installer/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-bootstrap-installer/installer/index.tcl,v
diff -u -r1.14 -r1.15
--- openacs-4/packages/acs-bootstrap-installer/installer/index.tcl 24 Sep 2003 14:57:45 -0000 1.14
+++ openacs-4/packages/acs-bootstrap-installer/installer/index.tcl 10 Oct 2003 14:52:16 -0000 1.15
@@ -260,10 +260,132 @@
# thing to be installed is the apm_packages table - does that exist?
if { ![db_table_exists apm_packages] } {
# Nope. Need to install the data model.
- append body "
The next step is to install the OpenACS kernel data model. Click the Next - button to proceed. + + # Get the default for system_url. First try to get it from the nssock + # hostname setting - if that is not available then try ns_info + # hostname, use yourdomain.com if that fails too. + if { [catch { + set system_url "http://[ns_config "ns/server/[ns_info server]/module/nssock" hostname [ns_info hostname]]" + + # append port number if non-standard port + if { !([ns_conn port] == 0 || [ns_conn port] == 80) } { + append system_url ":[ns_conn port]" + } + + }] } { + set system_url "http://yourdomain.com" + } + + append body " + +
+ Once your server is installed, you can choose to have users login with username instead of email. + This is particularly useful if you're authenticating against other services, such as LDAP or the + local operating system, which may not use email as the basis of authentication. +
" } else { # OK, apm_packages is installed - let's check out some other stuff too: Fisheye: Tag 1.10 refers to a dead (removed) revision in file `openacs-4/packages/acs-bootstrap-installer/installer/install-data-model.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/acs-bootstrap-installer/installer/install.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-bootstrap-installer/installer/install.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-bootstrap-installer/installer/install.tcl 10 Oct 2003 14:52:16 -0000 1.1 @@ -0,0 +1,167 @@ +ad_page_contract { + Carries out the full OpenACS install. + + @author Peter Marklund + @cvs-id $Id: install.tcl,v 1.1 2003/10/10 14:52:16 peterm Exp $ + +} { + email:notnull + {username ""} + first_names:notnull + last_name:notnull + password:notnull + password_confirmation:notnull + + system_url:notnull + system_name:notnull + publisher_name:notnull + system_owner:notnull + admin_owner:notnull + host_administrator:notnull + outgoing_sender:notnull + new_registrations:notnull +} + +############## +# +# System setting validation +# +############# + +if { [string compare $password $password_confirmation] } { + install_return 200 "Passwords Don't Match" " +The passwords you've entered don't match. Please try again. +" + return +} + +############## +# +# Install data model +# +############# + +ns_write "[install_header 200 "Installing Kernel Data Model"] +" + +if { ![install_good_data_model_p] } { + install_do_data_model_install +} else { + ns_write "Kernel data model already installed." +} + +############## +# +# Install packages +# +############# + +install_do_packages_install + +############## +# +# Secret tokens +# +############# + +ns_write "Generating secret tokens..." +populate_secret_tokens_db +ns_write "
Done.
" + +############## +# +# Admin create +# +############# + +if { [empty_string_p $username] } { + set username $email +} + +if { ![db_string user_exists { + select count(*) from parties where email = lower(:email) +}] } { + + db_transaction { + + set user_id [ad_user_new \ + $email \ + $first_names \ + $last_name \ + $password \ + "" \ + "" \ + "" \ + "t" \ + "approved" \ + "" \ + $username] + if { !$user_id } { + + global errorInfo + install_return 200 "Unable to Create Administrator" " + +Unable to create the site-wide administrator: + +
+ +Please try again. + +" + return + } + + # stub util_memoize_flush... + rename util_memoize_flush util_memoize_flush_saved + proc util_memoize_flush {args} {} + permission::grant -party_id $user_id -object_id [acs_lookup_magic_object security_context_root] -privilege "admin" + # nuke stub + rename util_memoize_flush {} + rename util_memoize_flush_saved util_memoize_flush + } +} + +############## +# +# System settings +# +############# + +set kernel_id [db_string acs_kernel_id_get { + select package_id from apm_packages + where package_key = 'acs-kernel' +}] + +foreach { var param } { + system_url SystemURL + system_name SystemName + publisher_name PublisherName + system_owner SystemOwner + admin_owner AdminOwner + host_administrator HostAdministrator + outgoing_sender OutgoingSender +} { + ad_parameter -set [set $var] -package_id $kernel_id $param +} + +# set the Main Site RestrictToSSL parameter + +set main_site_id [db_string main_site_id_select { + select package_id from apm_packages + where instance_name = 'Main Site' +}] + +ad_parameter -set "acs-admin/*" -package_id $main_site_id RestrictToSSL +ad_parameter -set $new_registrations -package_id $main_site_id NewRegistrationEmailAddress + +# We're done - kill the server (will restart if server is setup properly) +ad_schedule_proc -thread t -once t 1 ns_shutdown + +ns_write "Installation finished + +[ns_quotehtml $errorInfo]
The server has been shut down. Normally, it should come back up by itself after a minute or so.
+ +If not, please check your server error log, or contact your system administrator.
+ +[install_footer] +" Fisheye: Tag 1.12 refers to a dead (removed) revision in file `openacs-4/packages/acs-bootstrap-installer/installer/packages-install.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.5 refers to a dead (removed) revision in file `openacs-4/packages/acs-bootstrap-installer/installer/site-info-2.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.5 refers to a dead (removed) revision in file `openacs-4/packages/acs-bootstrap-installer/installer/site-info.tcl'. Fisheye: No comparison available. Pass `N' to diff?