bin/chroot-libs in utils-0.0.39 vs bin/chroot-libs in utils-0.0.40
- old
+ new
@@ -7,12 +7,16 @@
executable = ARGV.shift or fail msg
dir = ARGV.shift or fail msg
dir = File.expand_path dir
mkdir_p dir
-executable = `which #{executable}`.chomp
+unless executable.start_with? '/'
+ executable = `which #{executable}`.chomp
+end
libs = `ldd #{executable}`.gsub(/^(?:.*?\s+=>\s+|\s+)(.*?)\(.*/, '\1').grep(/\S/).map { |x| x.strip }
libs.concat ARGV
-cd dir
-for l in libs
- cp l, File.basename(l)
+cd dir do
+ cp executable, File.basename(executable)
+ for l in libs
+ cp l, File.basename(l)
+ end
end