Module: Untar

Defined in:
lib/el4r/el4r-sub.rb

Overview

untar

Instance Method Summary collapse

Instance Method Details

#untar_command(file) ⇒ Object

Returns a command to uncompress an archive FILE.



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/el4r/el4r-sub.rb', line 164

def untar_command(file)
  f = file
  case f
  when /\.tar\.gz$/, /\.tgz$/
    "(tar xzvf #{f} || tar xvf #{f})"
  when /\.tar\.bz2$/
    "(tar xjvf #{f} || tar xvf #{f})"
  when /\.tar$/, /\.gz$/
    "tar xf #{f}"
  when /\.zip$/
    "unzip #{f}"
  when /\.lzh$/
    "lha x #{f}"
  when /\.afz$/
    "afio -ivZ #{f}"
  when /\.rar$/i
    "unrar %s"
  when /\.sit$/i
    "ln -s %s tmp.sit; unstuff tmp.sit"
  else
    nil
  end
end