bug 3981: Add more logs for long running operations

This commit is contained in:
Chiradeep Vittal 2011-01-18 17:05:04 -08:00
parent 1d8ece0671
commit 8ca5028430

View File

@ -45,6 +45,25 @@ untar() {
} }
is_compressed() {
local ft=$(file $1| awk -F" " '{print $2}')
local tmpfile=${1}.tmp
case $ft in
gzip) ctype="gzip"
;;
bzip2) ctype="bz2"
;;
ZIP) ctype="zip"
;;
*) echo "File $1 does not appear to be compressed" >&2
return 1
;;
esac
echo "Uncompressing to $tmpfile (type $ctype)...could take a long time" >&2
return 0
}
uncompress() { uncompress() {
local ft=$(file $1| awk -F" " '{print $2}') local ft=$(file $1| awk -F" " '{print $2}')
local tmpfile=${1}.tmp local tmpfile=${1}.tmp
@ -78,7 +97,7 @@ create_from_file() {
local tmpltimg=$2 local tmpltimg=$2
local tmpltname=$3 local tmpltname=$3
#copy the file to the disk echo "Moving to /$tmpltfs/$tmpltname...could take a while" >&2
mv $tmpltimg /$tmpltfs/$tmpltname mv $tmpltimg /$tmpltfs/$tmpltname
} }
@ -147,6 +166,7 @@ if [ -n "$cksum" ]
then then
verify_cksum $cksum $tmpltimg verify_cksum $cksum $tmpltimg
fi fi
is_compressed $tmpltimg
tmpltimg2=$(uncompress $tmpltimg) tmpltimg2=$(uncompress $tmpltimg)
rollback_if_needed $tmpltfs $? "failed to uncompress $tmpltimg\n" rollback_if_needed $tmpltfs $? "failed to uncompress $tmpltimg\n"