Module: E2Phokz

Defined in:
lib/e2phokz.rb

Overview

e2phokz: script which copies and optionally compresses ext2/ext3 filesystem it only copies used block, instead of free blocks it writes zeros

usage: e2phokz block_device_or_image_file output_file [stomp_channel_name]

if output_file is suffixed with .gz, output will be compressed if output_file is -, output will be sent to stdout if optional stomp channel name is supplied, progress info will be sent there. Script reads /etc/e2phokz.yml to get server info and credential.

Defined Under Namespace

Classes: App

Constant Summary collapse

CONFIG_FILENAME =
"/etc/e2phokz.yml"

Class Method Summary collapse

Class Method Details

.config_fileObject



249
250
251
252
253
254
255
256
257
258
259
260
261
262
# File 'lib/e2phokz.rb', line 249

def E2Phokz.config_file
  return if File.exists?(CONFIG_FILENAME)
  begin
    File.open(CONFIG_FILENAME,'w') do |f|
      f.puts("# sample config - you can just ignore this if you do not inted to use stomp")
      f.puts(E2Phokz.sample_config.to_yaml)
    end
    system("editor #{CONFIG_FILENAME}")
  rescue
    puts "I was not able to place sample config to #{CONFIG_FILENAME}."
    puts "Please do it yourself. Config is only needed for stomp."
    puts "If you do not intend to use stomp, you can just ignore this."
  end
end

.main(options) ⇒ Object



268
269
270
271
# File 'lib/e2phokz.rb', line 268

def E2Phokz.main(options)
   E2Phokz.config_file
   E2Phokz::App.new(options).run!
end

.sample_configObject



264
265
266
# File 'lib/e2phokz.rb', line 264

def E2Phokz.sample_config
  {"stomp"=>{"server"=>"stompserver.domain.tld", "user"=>"username", "port"=>61613, "password"=>"secure_enough_password"}}
end