Sha256: 85e28dd6e2b424309cbb9d790012c8398597d849341581f4330826a3acc326bc

Contents?: true

Size: 616 Bytes

Versions: 28

Compression:

Stored size: 616 Bytes

Contents

#!/usr/bin/env ruby

require 'fileutils'
include FileUtils::Verbose

msg = "Usage: #$0 EXECUTABLE DIR [LIB ..]"
executable = ARGV.shift or fail msg
dir = ARGV.shift or fail msg
dir = File.expand_path dir
mkdir_p dir

unless executable.start_with? '/'
  executable = `which #{executable}`.chomp
end
libs = `ldd #{executable}`.gsub(/^(?:.*?\s+=>\s+|\s+)(.*?)\(.*/, '\1').lines.grep(/\S/).map { |x| x.strip }
libs.concat ARGV
cd dir do
  cp executable, File.basename(executable)
  for l in libs
    begin
      cp l, File.basename(l)
    rescue Errno::ENOENT => e
      warn "Caught #{e.class}: #{e}"
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
utils-0.2.4 bin/chroot-libs
utils-0.2.3 bin/chroot-libs
utils-0.2.2 bin/chroot-libs
utils-0.2.1 bin/chroot-libs
utils-0.2.0 bin/chroot-libs
utils-0.1.1 bin/chroot-libs
utils-0.1.0 bin/chroot-libs
utils-0.0.100 bin/chroot-libs