class RBT::RemoveProgram
Constants
- DEFAULT_PROGRAM
#¶ ↑
DEFAULT_PROGRAM
¶ ↑#¶ ↑
Public Class Methods
new( this_program = DEFAULT_PROGRAM, run_already = true )
click to toggle source
#¶ ↑
initialize¶ ↑
@install_type may be of these two values:
:fhs :app_dir
The default is :app_dir. This means to check under the /Programs/ hierarchy.
#¶ ↑
# File lib/rbt/utility_scripts/remove_program.rb, line 39 def initialize( this_program = DEFAULT_PROGRAM, run_already = true ) reset set_this_program(this_program) run if run_already end
Public Instance Methods
remove_broken_symlinks()
click to toggle source
#¶ ↑
remove_broken_symlinks
¶ ↑
Delegate towards class RBT::RemoveSymlinks
here.
#¶ ↑
# File lib/rbt/utility_scripts/remove_program.rb, line 174 def remove_broken_symlinks opne 'Removing broken symlinks next.' RBT::RemoveSymlinks.new end
remove_current_link()
click to toggle source
#¶ ↑
remove_current_link
¶ ↑
This method attempts to remove the ‘Current’ symlink.
#¶ ↑
# File lib/rbt/utility_scripts/remove_program.rb, line 157 def remove_current_link _ = @this_dir[0..-2] if File.exist? _ result = 'Now removing'.dup result << ' the symlink' if File.symlink? _ result << " `#{sdir(_)}`." opne result remove(_) end end
remove_program( this_program = @remove_this_program )
click to toggle source
#¶ ↑
remove_program
¶ ↑
This is the actual powerhorse of this script.
#¶ ↑
# File lib/rbt/utility_scripts/remove_program.rb, line 111 def remove_program( this_program = @remove_this_program ) _ = @install_type case _ # case tag # ======================================================================= # # === remove_program evince # ======================================================================= # when :app_dir, :gobo, :gobolinux_mode set_program_path(rds(programs_dir?)) base_dir = @program_path+this_program @this_dir = "#{base_dir}/Current/" opne 'Removing program `'+sdir(@this_dir)+'` now' # Tell the user what to do. # ===================================================================== # # First, clean-up any stray symlinks into the /usr/include # hierarchy. # ===================================================================== # try_to_remove_stray_symlinks_from_the_usr_include_hierarchy( @this_dir+'include/' ) remove_directory(@this_dir) # ===================================================================== # # Next, we get rid of the symlinks and the current link. # ===================================================================== # remove_broken_symlinks # Remove all broken Symlinks. remove_current_link # And remove the 'Current' symlink as well. # ======================================================================= # # === :fhs # ======================================================================= # when :fhs # ===================================================================== # # Currently not implemented. # ===================================================================== # else e "Unregistered Type (#{sfancy(_)})." end run_ldconfig end
reset()
click to toggle source
#¶ ↑
reset¶ ↑
#¶ ↑
Calls superclass method
RBT::Base#reset
# File lib/rbt/utility_scripts/remove_program.rb, line 51 def reset super() infer_the_namespace # ======================================================================= # # === @install_type # ======================================================================= # @install_type = :app_dir end
run()
click to toggle source
run_ldconfig()
click to toggle source
set_program_path( i = rds(programs_dir?) )
click to toggle source
set_this_program(i = DEFAULT_PROGRAM)
click to toggle source
try_to_remove_stray_symlinks_from_the_usr_include_hierarchy( i = @this_dir+'include/' )
click to toggle source
#¶ ↑
try_to_remove_stray_symlinks_from_the_usr_include_hierarchy
¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/remove_program.rb, line 84 def try_to_remove_stray_symlinks_from_the_usr_include_hierarchy( i = @this_dir+'include/' ) possible_targets = Dir[i+'*'] possible_targets.each {|entry| # ===================================================================== # # Specifcy the /usr/include/ target next. # ===================================================================== # target = "/usr/include/#{File.basename(entry)}" # ===================================================================== # # Ok, we must check whether the target exists, and whether it is # a symlink, and whether it points to @this_dir. # ===================================================================== # if File.exist?(target) and File.symlink?(target) and File.readlink(target).include?(@this_dir) # This line is just an additional safeguard. opne 'Now removing the symlink at `'+sfile(target)+'` as well.' delete(target) end } end