class RBT::Linux::RenameSystemMap

Constants

USR_SRC_LINUX
#

USR_SRC_LINUX

#

Public Class Methods

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

RBT::Linux::RenameSystemMap[]

#
# File lib/rbt/linux/kernel/rename_system_map.rb, line 81
def self.[](i = '')
  new(i)
end
new( run_already = true ) click to toggle source
#

initialize

#
# File lib/rbt/linux/kernel/rename_system_map.rb, line 33
def initialize(
    run_already           = true
  )
  reset
  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/linux/kernel/rename_system_map.rb, line 43
def reset
  super()
  infer_the_namespace
  # ======================================================================= #
  # === @kernel_version
  # ======================================================================= #
  @kernel_version = '5.4.31'
end
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/linux/kernel/rename_system_map.rb, line 55
def run
  _ = 'System.map'
  if File.exist? _
    # ===================================================================== #
    # First we try to determine whether we have a readlink from which
    # we can infer the kernel version.
    # ===================================================================== #
    if File.symlink?(USR_SRC_LINUX)
      @kernel_version = File.readlink(USR_SRC_LINUX).split('-').last.strip
    end
    new_name = "#{_}-#{@kernel_version}"
    if File.exist? new_name
      opne "Can not rename #{sfile(new_name)} as it already exists"
      opne 'at '+steelblue("/boot/#{new_name}")
    else
      opne "Renaming the file #{sfile(_)} to #{sfile(new_name)}."
      rename_file(_, new_name)
    end
  else
    no_file_exists_at _
  end
end