- Allow tar to take a chdir option.

This commit is contained in:
Jordan Sissel 2011-01-06 18:39:30 -08:00
parent 876f81367d
commit ed72b8e3ba
1 changed files with 5 additions and 3 deletions

View File

@ -67,7 +67,7 @@ class FPM::Source
end
private
def tar(output, paths)
def tar(output, paths, chdir=".")
dirs = []
paths.each do |path|
while path != "/" and path != "."
@ -75,7 +75,9 @@ class FPM::Source
path = File.dirname(path)
end
end # paths.each
system(*["tar", "--owner=root", "--group=root", "-cf", output, "--no-recursion", *dirs]) if dirs.any?
system(*["tar", "--owner=root", "--group=root", "-rf", output, *paths])
system(*["tar", "-C", chdir, "--owner=root", "--group=root",
"-cf", output, "--no-recursion", *dirs]) if dirs.any?
system(*["tar", "-C", chdir,
"--owner=root", "--group=root", "-rf", output, *paths])
end # def tar
end