how to have a cp progress bar?

Hi all,
This is a reformed post to my earlier ones!!!!!!

I would like to know how to include a progress bar while using the cp...
I am copying a few huge files from cdrom but am unable to figure out ,how to give a progress bar!!!!!

I checked out other sites as well,but the issue here is that,this cp is happenning in one of the boot scripts during boot time!!!

So i cannot have other explicit executable scripts that run within an already running script, also i tried converting some script to functions and passing these files as args,but didnt work!!!!

So could you pls give out some scripts (plain scripts) that do the job?

Thanks

Here's a quick hack. If you don't have awk or stat available, I don't imagine you will have Perl, either.

#!/bin/sh
#
# cpbar -- era 2008-05-21 for unix.com
#
# Depends:
#  stat
#  cp
#  awk

syntax () {
    echo "Syntax: $0 srcfile destfile" >&2
    echo " " "$@" >&2
    exit 1
}

test -r "$1" || syntax "File '$1' not found"
test -d "$2" && syntax "Must name destination file ('$2' is a directory)"

size=`stat -c %s "$1"`

cp "$1" "$2" &
cppid=$!

trap 'echo; kill $cppid; rm -f "$2"; exit 127' 1 2 3 5 15

while true; do
    nsize=`stat -c %s "$2"`
    awk -v f1="$1" -v f2="$2" -v size=$size -v nsize=$nsize '
	BEGIN { printf "Copying %s to %s: %4.2f%%\r", f1, f2, 100*nsize/size }'
    case $nsize in $size) break ;; esac
    sleep 1
done

echo

wait $cppid