Index: openacs-4/packages/acs-bootstrap-installer/installer/auto-install.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-bootstrap-installer/installer/Attic/auto-install.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/acs-bootstrap-installer/installer/auto-install.tcl 9 May 2001 22:32:25 -0000 1.2 +++ openacs-4/packages/acs-bootstrap-installer/installer/auto-install.tcl 30 Aug 2001 20:42:53 -0000 1.3 @@ -46,57 +46,76 @@ " db_source_sql_file -callback apm_ns_write_callback acs-kernel-create.sql ns_write "

" - apm_version_enable -callback apm_ns_write_callback [apm_package_install "[acs_root_dir]/packages/acs-kernel/acs-kernel.info"] -} -ns_write "

  • NOT Generating secret tokens\ - for secure login sessions..." -populate_secret_tokens_db -ns_write "

    Done.

    " + # 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. + # JM: Now even uglier, because I just cut and pasted this from + # install-data-model.tcl into auto-install.tcl, too. + 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 { ![ad_acs_administrator_exists_p] } { - ns_write "

  • Creating site-wide administrator $email with password $password." - db_transaction { - set user_id [ad_user_new $email $first_names $last_name $password $password_question $password_answer] - db_dml grant_admin { - begin - acs_permission.grant_permission ( - object_id => acs.magic_object_id('security_context_root'), - grantee_id => :user_id, - privilege => 'admin' - ); - end; + 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) + } } - } on_error { - global errorInfo - install_return 200 "Unable to Create Administrator" " - -Unable to create the site-wide administrator: - -
    [ad_quotehtml $errorInfo]
    -" - ad_script_abort } + apm_version_enable -callback apm_ns_write_callback [apm_package_install "[acs_root_dir]/packages/acs-kernel/acs-kernel.info"] } ns_write "

  • Installing packages.

    " # Attempt to install all packages. -set dependency_results [apm_dependency_check -initial_install [apm_scan_packages -new [acs_root_dir]/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 +ns_write "

    Done." # Complete the initial install. ns_write "

  • Completing Install sequence.

    " +cd [file join [acs_root_dir] packages acs-kernel sql [db_type]] db_source_sql_file -callback apm_ns_write_callback acs-install.sql -ns_write "
    ." +ns_write "

    Done." -ns_write "

  • Mounting packages.

    " +# Generate tokens. +ns_write "

  • NOT Generating secret tokens\ + for secure login sessions..." +populate_secret_tokens_db +ns_write "

    Done.

    " +# Create the site-wide administrator. +if { ![ad_acs_administrator_exists_p] } { + ns_write "

  • Creating site-wide administrator $email with password $password." + db_transaction { + set user_id [ad_user_new $email $first_names $last_name $password $password_question $password_answer] + db_exec_plsql grant_admin { + begin + acs_permission.grant_permission ( + object_id => acs.magic_object_id('security_context_root'), + grantee_id => :user_id, + privilege => 'admin' + ); + end; + } + } +} + # Instantiate and mount all uninstantiated packages. +ns_write "

  • Mounting packages.

    " db_foreach all_unmounted_package_key { select t.package_key @@ -122,6 +141,17 @@ ad_parameter -set [set $var] -package_id [ad_acs_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 + +# We are finished installing + db_release_unused_handles ns_write "

    Installation Complete. Please restart your server.[install_footer]" exit