class RBT::ReconstituteGlibc

Public Class Methods

[](i = ARGV) click to toggle source
#

RBT:ReconstituteGlibc[]

#
# File lib/rbt/utility_scripts/reconstitute_glibc.rb, line 101
def self.[](i = ARGV)
  new(i)
end
new( commandline_arguments = nil, run_already = true ) click to toggle source
#

initialize

#
# File lib/rbt/utility_scripts/reconstitute_glibc.rb, line 25
def initialize(
    commandline_arguments = nil,
    run_already           = true
  )
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  run if run_already
end

Public Instance Methods

reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method RBT::Base#reset
# File lib/rbt/utility_scripts/reconstitute_glibc.rb, line 39
def reset
  super()
  infer_the_namespace
end
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/utility_scripts/reconstitute_glibc.rb, line 47
def run
  # ======================================================================= #
  # Obtain the dataset for glibc first.
  # ======================================================================= #
  dataset = RBT.cookbook(:glibc)
  opne "Trying to reconstitute glibc into #{sdir(/opt/)}."
  glibc_name_and_version  = dataset.program_name_and_program_version?
  dataset_program_version = dataset.program_version?.dup
  rcp(
    glibc_name_and_version
  ) {{ use_this_directory_as_the_program_directory: '/opt/' }}
  libraries = dataset.libraries?
  opne "(1) Trying to copy all libraries of glibc "\
       "(#{glibc_name_and_version}) next:"
  libraries.each {|this_library|
    existing_target = '/lib64/'+this_library
    unless File.exist? existing_target
      existing_target = '/usr/lib64/'+this_library
    end
    copy_file(
      existing_target,
      '/opt/Glibc/'+dataset_program_version+'/lib/'
    )
  }
  binaries = dataset.binaries?
  opne "(2) Trying to copy all binaries of glibc "\
       "(#{glibc_name_and_version}) next:"
  binaries.each {|this_binary|
    existing_target = '/usr/bin/'+this_binary
    unless File.exist? existing_target
      existing_target = '/bin/'+this_binary
    end
    copy_file(
      existing_target,
      '/opt/Glibc/'+dataset_program_version+'/bin/'
    )
  }
  headers = dataset.headers?
  opne "(3) Trying to copy all headers of glibc "\
       "(#{glibc_name_and_version}) next:"
  headers.each {|this_header|
    existing_target = '/usr/include/'+this_header
    copy_file(
      existing_target,
      '/opt/Glibc/'+dataset_program_version+'/include/'
    )
  }
  opne "Note that this class is not yet perfect; it has a few bugs;"
  opne "I use it primarily as bootstrap-helper."
end