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.22.1 bin/chroot-libs
utils-0.22.0 bin/chroot-libs
utils-0.21.2 bin/chroot-libs
utils-0.21.1 bin/chroot-libs
utils-0.21.0 bin/chroot-libs
utils-0.20.0 bin/chroot-libs
utils-0.19.0 bin/chroot-libs
utils-0.18.1 bin/chroot-libs
utils-0.18.0 bin/chroot-libs
utils-0.17.0 bin/chroot-libs
utils-0.16.0 bin/chroot-libs
utils-0.15.1 bin/chroot-libs
utils-0.15.0 bin/chroot-libs
utils-0.14.0 bin/chroot-libs
utils-0.13.0 bin/chroot-libs
utils-0.12.0 bin/chroot-libs
utils-0.11.0 bin/chroot-libs
utils-0.10.1 bin/chroot-libs
utils-0.10.0 bin/chroot-libs
utils-0.9.0 bin/chroot-libs