methods/ks_server.rb
# Copy Linux ISO contents to repo
Copy Linux ISO contents to repo
Copy Linux ISO contents to repo
def configure_ks_repo(options)
  options['netbootdir'] = options['tftpdir']+"/"+options['service']
  if options['host-os-name'].to_s.match(/SunOS/)
    if options['host-os-version'].to_i < 11
      check_fs_exists(options,options['repodir'])
      if not File.symlink?(options['netbootdir'])
        File.symlink(options['repodir'],options['netbootdir'])
      end
    else
      check_fs_exists(options,options['repodir'])
      set_zfs_mount(options['repodir'],options['netbootdir'])
      if not File.symlink?(options['repodir'])
        Dir.delete(options['repodir'])
        File.symlink(options['netbootdir'],options['repodir'])
      end
    end
  end
  if options['host-os-name'].to_s.match(/Linux/)
    check_fs_exists(options,options['netbootdir'])
    if not File.symlink?(options['repodir'])
      check_dir_owner(options,options['baserepodir'],options['uid'])
      File.symlink(options['netbootdir'],options['repodir'])
    end
  end
  if options['repodir'].to_s.match(/sles/)
    check_dir = options['repodir']+"/boot"
  else
    check_dir = options['repodir']+"/isolinux"
  end
  if options['verbose'] == true
    handle_output(options,"Information:\tChecking directory #{check_dir} exits")
  end
  if not File.directory?(check_dir)
    mount_iso(options)
    copy_iso(options)
    umount_iso(options)
    if options['file'].to_s.match(/DVD1\.iso|1of2\.iso/)
      if options['file'].to_s.match(/DVD1/)
        options['file'] = options['file'].gsub(/1\.iso/,"2.iso")
      end
      if options['file'].to_s.match(/1of2/)
        options['file'] = options['file'].gsub(/1of2\.iso/,"2of2.iso")
      end
      mount_iso(options)
      copy_iso(options)
      umount_iso(options)
    end
  end
  if options['service'].to_s.match(/live/)
    orig_file = options['file'].to_s
    iso_file  = File.basename(orig_file)
    file_name = options['repodir'].to_s+"/"+iso_file
    if not File.exist?(file_name)
      message = "Information:\tCopying ISO file "+orig_file+" to "+file_name
      command = "cp #{orig_file} #{file_name}"
      execute_command(options,message,command)
    end
   end
  return
end
def configure_ks_repo ( options ) options [ 'netbootdir' ] = options [ 'tftpdir' ] + "/" + options [ 'service' ] if options [ 'host-os-name' ] . to_s . match ( / SunOS / ) if options [ 'host-os-version' ] . to_i < 11 check_fs_exists ( options , options [ 'repodir' ] ) if not File . symlink? ( options [ 'netbootdir' ] ) File . symlink ( options [ 'repodir' ] , options [ 'netbootdir' ] ) end else check_fs_exists ( options , options [ 'repodir' ] ) set_zfs_mount ( options [ 'repodir' ] , options [ 'netbootdir' ] ) if not File . symlink? ( options [ 'repodir' ] ) Dir . delete ( options [ 'repodir' ] ) File . symlink ( options [ 'netbootdir' ] , options [ 'repodir' ] ) end end end if options [ 'host-os-name' ] . to_s . match ( / Linux / ) check_fs_exists ( options , options [ 'netbootdir' ] ) if not File . symlink? ( options [ 'repodir' ] ) check_dir_owner ( options , options [ 'baserepodir' ] , options [ 'uid' ] ) File . symlink ( options [ 'netbootdir' ] , options [ 'repodir' ] ) end end if options [ 'repodir' ] . to_s . match ( / sles / ) check_dir = options [ 'repodir' ] + "/boot" else check_dir = options [ 'repodir' ] + "/isolinux" end if options [ 'verbose' ] == true handle_output ( options , "Information:\tChecking directory #{check_dir} exits" ) end if not File . directory? ( check_dir ) mount_iso ( options ) copy_iso ( options ) umount_iso ( options ) if options [ 'file' ] . to_s . match ( / DVD1 \. iso|1of2 \. iso / ) if options [ 'file' ] . to_s . match ( / DVD1 / ) options [ 'file' ] = options [ 'file' ] . gsub ( / 1 \. iso / , "2.iso" ) end if options [ 'file' ] . to_s . match ( / 1of2 / ) options [ 'file' ] = options [ 'file' ] . gsub ( / 1of2 \. iso / , "2of2.iso" ) end mount_iso ( options ) copy_iso ( options ) umount_iso ( options ) end end if options [ 'service' ] . to_s . match ( / live / ) orig_file = options [ 'file' ] . to_s iso_file = File . basename ( orig_file ) file_name = options [ 'repodir' ] . to_s + "/" + iso_file if not File . exist? ( file_name ) message = "Information:\tCopying ISO file " + orig_file + " to " + file_name command = "cp #{orig_file} #{file_name}" execute_command ( options , message , command ) end end return end
Copy Linux ISO contents to repo
Copy Linux ISO contents to repo
options
<not_specific>