Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like to know if it's possible to capture download progress i.e percentage download complete shown by 'yum' while it's downloading a package. Capture, in the sense, could be to a text file or programatically using JAVA, for an instance, if I run the yum installer from JAVA.

I've tried yum install pkg_name > captured, but it captures the standard output only without the progress information.

I've also checked stderr, no result.

E.g.

Setting up Install Process Resolving Dependencies

--> Running transaction check

---> Package wget.i686 0:1.12-4.fc14 set to be installed

--> Finished Dependency Resolution

Dependencies Resolved

================================================================================ Package Arch Version Repository Size

================================================================================

Installing: wget i686 1.12-4.fc14 updates 481 k

Transaction Summary

================================================================================ Install 1 Package(s)

Total download size: 481 k

Installed size: 1.8 M Downloading Packages:

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

Installing : wget-1.12-4.fc14.i686 1/1

Installed:

Wget.i686 0:1.12-4.fc14

Complete! 

Along with the above info, I'd also like to the capture the progress part i.e percentage complete that is shown below the 'Downloading Packages:' label while downloading.

I don't use Python scripts.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

The progress bars are written out only when the output is going to terminal. You may simulate that with using expect (with ExpectJ being Java implementation) but parsing application output (thing called screen scraping) can be very fragile method and would break when output changes, for example depending on width of output terminal, length of package names and perhaps other things.

Yum is written in python and is extensible with plugins so you may try to write a plugin to talk to your application and notify on the progress, but it does not look worth the trouble to me.

Here are the docs if you decided to go that way.

To simply wrap yum in an expect you can use something like:

#!/usr/bin/expect -f
set timeout 600
spawn yum -y install zsh-html
expect eof

After this you can catch output and see packages being downloaded there.

share|improve this answer
    
That was very useful. I don't have enough reputation to give you an up :( –  SSaikia_JtheRocker Jan 30 '12 at 18:08
    
Lessons learned: never answer a question from someone with low reputation ;-) [Do not worry about that, glad to help!] –  Martian Jan 31 '12 at 22:57
2  
@JtheRocker I upvoted for you :) Just giving credit where it needs to be given... –  Halil Özgür Mar 1 '12 at 8:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.