Class: Roebe::GrubAppender
- Defined in:
- lib/roebe/classes/grub_appender.rb
Overview
Roebe::GrubAppender
Constant Summary collapse
- DEFAULT_FILE_MODE =
#
DEFAULT_FILE_MODE
#
'a+'
- HDD_TO_USE =
#
HDD_TO_USE
The harddisc to use.
HDD_TO_USE = ‘UUID=94680a0d-f4ca-4cff-b3d2-ed0520584bd1’
#
'/dev/sda1'
- INITRD_NAME =
#
INITRD_NAME
#
'initrd.img'
- ROOT_BASE =
#
ROOT_BASE
This designates the main harddisc in use.
#
'hd0,0'
- BASE_DIR_FOR_GRUB =
#
BASE_DIR_FOR_GRUB
#
'/boot/grub'
- DEFAULT_GRUB_LOCATION =
#
DEFAULT_GRUB_LOCATION
#
BASE_DIR_FOR_GRUB+'/menu.lst'
- STD_COMMENT =
#
STD_COMMENT
#
'# ====================================================================== #'
- GRUB_SKELETON_INFORMATION =
#
GRUB_SKELETON_INFORMATION
This contains the german keyboard layout.
#
STD_COMMENT+' # Deutsche Tastaturbelegung / German Keyboard Layout. # ====================================================================== # setkey y z setkey z y setkey Y Z setkey Z Y setkey equal parenright setkey parenright parenleft setkey parenleft asterisk setkey doublequote at setkey plus bracketright setkey minus slash setkey slash ampersand setkey ampersand percent setkey percent caret setkey underscore question setkey question underscore setkey semicolon less setkey less numbersign setkey numbersign backslash setkey colon greater setkey greater bar setkey asterisk braceright'
Constants inherited from Base
Base::COLOURS, Base::HOME_DIRECTORY_OF_USER_X, Base::N, Base::NAMESPACE
Class Method Summary collapse
-
.[](i = '') ⇒ Object
# === Roebe::GrubAppender[] ========================================================================= #.
Instance Method Summary collapse
-
#append_what_to(write_what = GRUB_SKELETON_INFORMATION, target = DEFAULT_GRUB_LOCATION) ⇒ Object
# === append_what_to.
-
#available_kernels ⇒ Object
# === available_kernels.
-
#create_menu_lst ⇒ Object
# === create_menu_lst.
-
#initialize(i = nil, run_already = true) ⇒ GrubAppender
constructor
# === initialize ========================================================================= #.
-
#input? ⇒ Boolean
# === input? ========================================================================= #.
-
#on_gobolinux? ⇒ Boolean
# === on_gobolinux? ========================================================================= #.
-
#reset ⇒ Object
# === reset (reset tag) ========================================================================= #.
-
#run ⇒ Object
# === run (run tag) ========================================================================= #.
-
#set_input(i = '') ⇒ Object
# === set_input ========================================================================= #.
Methods inherited from Base
#actions, #append_this_onto_that_file, #append_what_into, #be_silent, #be_verbose?, #beautiful_url, #burlywood, #call_next, #chdir, #cheerful_guy, #cliner, #complex_esystem, #convert_global_env, #copy_directory, #copy_file, #cornflowerblue, #create_directory, #crimson, #current_month?, #current_time?, #current_year?, #cyan, #darkcyan, #darkgreen, #darkkhaki, #darkslateblue, #deeppink, #delete_symlink, #do_not_use_the_base_colours, #do_use_the_base_colours, #e, #ecomment, #editor_to_use?, #efancy, #eimp, #emphasis, #ensure_main_encoding, #ensure_utf_encoding, #eparse, #erev, #esteelblue, #etomato, #ewarn, #firebrick, #get_current_day, #get_current_month, #get_files_and_directories, #get_files_from, #get_german_name_for_this_weekday, #gold, #green, #grey, #hh_mm_ss, #hh_mm_ss_day_month_year, #home_dir?, #home_directory_of_user_x?, #infer_the_namespace, #internal_hash?, #is_a_directory?, #is_a_file?, #is_a_jpg_file?, #is_an_image_file?, #is_archive?, #is_audio_file?, #is_in_studium_dir?, #is_multimedia_file?, #is_on_roebe?, #is_on_windows?, #is_studium_available?, #is_symlink?, #is_this_a_ruby_file?, #is_video_file?, #iso_encoding?, #le, #left_colour, #lightblue, #lightgreen, #lightseagreen, #lightsteelblue, #lime, #limegreen, #localhost_to_data, #log_directory?, #main_encoding?, #mediumorchid, #mediumpurple, #mediumseagreen, #mediumslateblue, #mediumspringgreen, #mediumturquoise, #mkdir_p, #mv, #n_days_in_this_month, #n_pages_in_this_pdf_file?, #namespace?, #no_file_exists_at, #olivedrab, #open_in_browser, #opne, #opnesystem, #opnn, #orange, #orchid, #palegoldenrod, #palevioletred, #pink, #powderblue, #programs_dir?, #project_base_dir?, #random_html_colour, #rds, #read_file_in_iso_encoding, #read_file_via_the_default_encoding, #read_lines_via_iso_encoding, #readlines_with_main_encoding, #red, #register_sigint, #remove, #remove_directory, #remove_file, #rename_kde_konsole_tab, #replace_localhost_with_data, #report_pwd, #require_rescue, #reset_the_internal_hash, #return_all_directories_from_this_directory, #return_all_files_from_this_directory, #return_current_directory, #return_dd_mm_yyyy, #return_file_or_directory_of, #return_files_from_pwd, #return_last_part_of_the_current_directory, #return_utc, #rev, #right_arrow?, #right_colour, #roebe_log_directory?, #rosybrown, #royalblue, #ruby_base_directory?, #run_in_background, #run_rcfiles_then_run_ata_via_qdbus, #sandybrown, #sdir, #seagreen, #set_be_verbose, #set_xorg_buffer, #sfancy, #sfile, #show_help, #silent_redirection?, #simp, #simple_esystem, #skyblue, #slateblue, #slategray, #springgreen, #steelblue, #swarn, #symlink, #teal, #temp_dir?, #to_camelcase, #to_counted_hash, #tomato, #touch, #try_to_require_the_beautiful_url_gem, #try_to_require_the_html_template, #try_to_require_the_open_gem, #try_to_require_the_program_information_gem, #try_to_require_the_xorg_buffer, #use_colours?, #verbose_truth, #weekday?, #word_wrap, #write_what_into, #yellow
Methods included from Base::CommandlineArguments
#append_onto_the_commandline_arguments, #clear_commandline_arguments, #commandline_arguments?, #commandline_arguments_as_string?, #commandline_arguments_without_leading_hyphens?, #first_argument?, #first_argument_without_leading_hyphens?, #has_an_argument_been_passed?, #remove_hyphened_arguments_from_the_commandline_arguments, #return_commandline_arguments_with_leading_hyphens, #second_argument?, #set_commandline_arguments
Constructor Details
#initialize(i = nil, run_already = true) ⇒ GrubAppender
#
initialize
#
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/roebe/classes/grub_appender.rb', line 99 def initialize( i = nil, run_already = true ) reset set_input(i) @boot_dir = '/boot/' @boot_dir = '/System/Kernel/Boot/' if on_gobolinux? # @root_entry contains the root entry :D e 'Starting to create grub entries from '+sfile(DEFAULT_GRUB_LOCATION) available_kernels if File.exist? BASE_DIR_FOR_GRUB # passthrough else e BASE_DIR_FOR_GRUB+' does not exist, thus we will create it.' create_directory BASE_DIR_FOR_GRUB end run if run_already end |
Class Method Details
Instance Method Details
#append_what_to(write_what = GRUB_SKELETON_INFORMATION, target = DEFAULT_GRUB_LOCATION) ⇒ Object
#
append_what_to
ONLY append.
#
193 194 195 196 197 198 199 200 |
# File 'lib/roebe/classes/grub_appender.rb', line 193 def append_what_to( write_what = GRUB_SKELETON_INFORMATION, target = DEFAULT_GRUB_LOCATION ) f = File.new(target, DEFAULT_FILE_MODE) f.print(write_what, N) f.close end |
#available_kernels ⇒ Object
#
available_kernels
Fetches which kernels are available.
#
207 208 209 210 211 212 213 214 215 216 217 218 |
# File 'lib/roebe/classes/grub_appender.rb', line 207 def available_kernels _ = Dir[@boot_dir+'*'].select {|entry| File.file?(entry) } case ENV['IS_GOBOLINUX_ENV'] when '1' _.reject! {|file| file !~ /kernel/ } else _.reject! {|file| file !~ /vmlinuz/ } end e 'It appears as if we have not found any kernel.' if _.size == 0 # kernel-2.6.23.8-Gobo @array_available_kernels = _ end |
#create_menu_lst ⇒ Object
#
create_menu_lst
This creates the actual menu.lst file.
#
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/roebe/classes/grub_appender.rb', line 158 def # ======================================================================= # # First delete file if it exists. # ======================================================================= # File.delete_if_exists DEFAULT_GRUB_LOCATION append_what_to 'default 0' append_what_to 'timeout 10'+N append_what_to # default skeleton. @array_available_kernels.each { |entry| if is_symlink? entry # pass through, do nothing. symlinks are a special case. elsif entry.include? '-' version = entry.split('-')[1] # /boot/vmlinuz-2.6.22.9 _ = ''.dup _ << N+STD_COMMENT+N _ << '# Kernel Eintrag für '+version+N _ << STD_COMMENT+N _ << 'title Kernel: '+version+N _ << @root_entry _ << ' kernel '+@boot_dir+'vmlinuz-'+version+' ro root='+HDD_TO_USE+' quiet'+N _ << ' initrd '+@boot_dir+INITRD_NAME+N+N if @use_initrd # append initrd append_what_to _ else ewarn 'Unfortunately a small error has occured. Your entry seems to' ewarn 'not include a - character.' pp '--> '+entry end } end |
#input? ⇒ Boolean
#
input?
#
149 150 151 |
# File 'lib/roebe/classes/grub_appender.rb', line 149 def input? @input end |
#on_gobolinux? ⇒ Boolean
#
on_gobolinux?
#
231 232 233 |
# File 'lib/roebe/classes/grub_appender.rb', line 231 def on_gobolinux? ENV['GOBOLINUX_LAYOUT'].to_s == '1' end |
#reset ⇒ Object
#
reset (reset tag)
#
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/roebe/classes/grub_appender.rb', line 121 def reset super() # ======================================================================= # # === @kernel_string # ======================================================================= # @kernel_string = 'kernel ' # ======================================================================= # # === @root_entry # ======================================================================= # @root_entry = ' root ('+ROOT_BASE+')'+N # ======================================================================= # # === @use_initrd # ======================================================================= # @use_initrd = true #false end |
#run ⇒ Object
#
run (run tag)
#
223 224 225 226 |
# File 'lib/roebe/classes/grub_appender.rb', line 223 def run e "Finished creating menu.lst at #{sfancy(DEFAULT_GRUB_LOCATION)}" end |