Index: openacs-4/packages/acs-bootstrap-installer/installer/packages-install.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-bootstrap-installer/installer/Attic/packages-install.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/acs-bootstrap-installer/installer/packages-install.tcl 25 Feb 2003 16:47:33 -0000 1.7 +++ openacs-4/packages/acs-bootstrap-installer/installer/packages-install.tcl 17 May 2003 09:40:03 -0000 1.8 @@ -59,8 +59,148 @@ apm_mount_core_packages ns_write "" + + # Now process the application bundle if an install.xml file was found. + + if { [nsv_exists acs_application node] } { + + ns_write "
Loading packages for the [nsv_get acs_application pretty_name] application.
" + + set actions [xml_node_get_children_by_name [nsv_get acs_application 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."
ns_write "
Generating secret tokens..."