Here is the script, very simple and effective 🙂
#!/bin/bash -
#===============================================================================
#
# FILE: mkchroot.sh
#
# USAGE: ./mkchroot.sh
#
# DESCRIPTION: Make a chroot environ and cd to it
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: Amit Agarwal (aka), # CREATED: 09/03/2011 02:53:37 PM IST
# Last modified: Sat Sep 03, 2011 03:11PM
# REVISION: ---
#===============================================================================
binaries=( bash2 ls cat vi vim sudo)
#=== FUNCTION ================================================================
# NAME: copy_binary
# DESCRIPTION: copy binary to chroot
# PARAMETERS:
# RETURNS:
#===============================================================================
copy_binary ()
{
cmd=`which $1`
echo $cmd
cp $cmd bin/
ldd $cmd
while read line
do
while read ld
do
if [[ -f $ld ]]
then
echo copy $ld
cp $ld lib/
if [[ -L $ld ]]
then
ld1=$( ls -l $ld |sed 's/.
Continue reading