Sha256: e953b013e0066a118e629342222d350ef7e1aea352b2f76338994b6530d91a05

Contents?: true

Size: 426 Bytes

Versions: 123

Compression:

Stored size: 426 Bytes

Contents

#!/usr/bin/env ruby

require 'fileutils'
include FileUtils

dir = ARGV.shift or fail 'require directory to chroot into'
prg = ARGV.shift || '/bin/bash'
system "mount -t proc none #{dir}/proc"
system "mount -o bind /dev #{dir}/dev"
File.exist?(resolv = "#{dir}/etc/resolv.conf") and
  cp resolv, resolv + '.bak'
cp '/etc/resolv.conf', resolv
system "chroot #{dir} #{prg}"
system "umount #{dir}/proc"
system "umount #{dir}/dev"

Version data entries

123 entries across 123 versions & 1 rubygems

Version Path
utils-0.2.4 bin/chroot-exec
utils-0.2.3 bin/chroot-exec
utils-0.2.2 bin/chroot-exec
utils-0.2.1 bin/chroot-exec
utils-0.2.0 bin/chroot-exec
utils-0.1.1 bin/chroot-exec
utils-0.1.0 bin/chroot-exec
utils-0.0.100 bin/chroot-exec
utils-0.0.99 bin/chroot-exec
utils-0.0.98 bin/chroot-exec
utils-0.0.97 bin/chroot-exec
utils-0.0.96 bin/chroot-exec
utils-0.0.95 bin/chroot-exec
utils-0.0.94 bin/chroot-exec
utils-0.0.93 bin/chroot-exec
utils-0.0.92 bin/chroot-exec
utils-0.0.91 bin/chroot-exec
utils-0.0.90 bin/chroot-exec
utils-0.0.89 bin/chroot-exec
utils-0.0.88 bin/chroot-exec