methods/ai_server.rb
# Main server routine called from modest main code
Main server routine called from modest main code
Main server routine called from modest main code
def configure_ai_server(options)
  clear_service(options,"svc:/system/install/server:default")
  enable_service(options,"svc:/system/install/server:default")
  iso_list = []
  check_default_route(options)
  check_dhcpd_config(options)
  check_dhcpd4_conf(options)
  services_list = get_ai_install_services(options)
  if options['service'].to_s.match(/[a-z,A-Z]/)
    if services_list.match(/#{options['service']}/)
      handle_output(options,"Warning:\tService #{options['service']} already exists")
      quit(options)
    end
  end
  if options['file'] != options['empty']
    if options['service'].to_s.match(/[a-z,A-Z]/)
      search_string = options['service'].gsub(/i386|sparc/,"")
      search_string = search_string.gsub(/sol_/,"sol-")
      search_string = search_string.gsub(/_beta/,"-beta")
      search_string = search_string+"-repo"
    else
      search_string = "repo"
    end
    option['search'] = search_string
    iso_list = get_base_dir_list(options)
  else
    iso_list[0] = file_name
  end
  if not iso_list[0]
    handle_output(options,"Warning:\tNo suitable ISOs found")
    quit(options)
  end
  iso_list.each do |file_name|
    if File.exist?(file_name)
      if !file_name.match(/repo/)
        handle_output(options,"Warning:\tISO #{file_name} does not appear to be a valid Solaris distribution")
        quit(options)
      end
    else
      handle_output(options,"Warning:\tISO #{file_name}'' does} not exist")
      quit(options)
    end
    iso_repo_version = File.basename(options['file'],".iso")
    iso_repo_version = iso_repo_version.split(/-/)[1]
    if file_name.match(/beta/)
      iso_repo_version = "sol_"+iso_repo_version+"_beta"
    else
      iso_repo_version = "sol_"+iso_repo_version
    end
    if !options['service'].to_s.match(/[a-z,A-Z,0-9]/)
      service_base_name = iso_repo_version
    else
      service_base_name = get_service_base_name(options)
    end
    options['repodir'] = get_ai_repo_dir(options,iso_repo_version)
    if !iso_repo_version.match(/11/)
      iso_repo_version = get_ai_solaris_release(options)
    end
    test_dir = options['repodir']+"/publisher"
    if !File.directory?(test_dir)
      check_ai_repo_dir(options)
      mount_iso(options)
      copy_iso(options)
    end
    check_ai_base_dir(options)
    read_only = "true"
    options   = check_ai_publisherport(options)
    configure_ai_pkg_repo(options,read_only)
    if $altrepo_mode == true
      alt_install_service = check_alt_install_service(options)
      configure_ai_alt_pkg_repo(options,alt_install_service)
    end
    options = get_ai_publisherurl(options)
    configure_ai_services(options,iso_repo_version)
    configure_ai_client_services(options,service_base_name)
  end
  fix_server_dhcpd_range(options)
end
def configure_ai_server ( options ) clear_service ( options , "svc:/system/install/server:default" ) enable_service ( options , "svc:/system/install/server:default" ) iso_list = [ ] check_default_route ( options ) check_dhcpd_config ( options ) check_dhcpd4_conf ( options ) services_list = get_ai_install_services ( options ) if options [ 'service' ] . to_s . match ( / [a-z,A-Z] / ) if services_list . match ( / #{ options [ 'service' ] } / ) handle_output ( options , "Warning:\tService #{options['service']} already exists" ) quit ( options ) end end if options [ 'file' ] != options [ 'empty' ] if options [ 'service' ] . to_s . match ( / [a-z,A-Z] / ) search_string = options [ 'service' ] . gsub ( / i386|sparc / , "" ) search_string = search_string . gsub ( / sol_ / , "sol-" ) search_string = search_string . gsub ( / _beta / , "-beta" ) search_string = search_string + "-repo" else search_string = "repo" end option [ 'search' ] = search_string iso_list = get_base_dir_list ( options ) else iso_list [ 0 ] = file_name end if not iso_list [ 0 ] handle_output ( options , "Warning:\tNo suitable ISOs found" ) quit ( options ) end iso_list . each do | file_name | if File . exist? ( file_name ) if ! file_name . match ( / repo / ) handle_output ( options , "Warning:\tISO #{file_name} does not appear to be a valid Solaris distribution" ) quit ( options ) end else handle_output ( options , "Warning:\tISO #{file_name}'' does} not exist" ) quit ( options ) end iso_repo_version = File . basename ( options [ 'file' ] , ".iso" ) iso_repo_version = iso_repo_version . split ( / - / ) [ 1 ] if file_name . match ( / beta / ) iso_repo_version = "sol_" + iso_repo_version + "_beta" else iso_repo_version = "sol_" + iso_repo_version end if ! options [ 'service' ] . to_s . match ( / [a-z,A-Z,0-9] / ) service_base_name = iso_repo_version else service_base_name = get_service_base_name ( options ) end options [ 'repodir' ] = get_ai_repo_dir ( options , iso_repo_version ) if ! iso_repo_version . match ( / 11 / ) iso_repo_version = get_ai_solaris_release ( options ) end test_dir = options [ 'repodir' ] + "/publisher" if ! File . directory? ( test_dir ) check_ai_repo_dir ( options ) mount_iso ( options ) copy_iso ( options ) end check_ai_base_dir ( options ) read_only = "true" options = check_ai_publisherport ( options ) configure_ai_pkg_repo ( options , read_only ) if $altrepo_mode == true alt_install_service = check_alt_install_service ( options ) configure_ai_alt_pkg_repo ( options , alt_install_service ) end options = get_ai_publisherurl ( options ) configure_ai_services ( options , iso_repo_version ) configure_ai_client_services ( options , service_base_name ) end fix_server_dhcpd_range ( options ) end
Main server routine called from modest main code
Main server routine called from modest main code
# Enable default package service # Check we have a default route (required for DHCPd to start) # Check that we have a DHCPd config file to write to # Get a list of installed services # If given a service name check the service doesn't already exist # Check we have ISO to get repository data from
options
<not_specific>