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 am attempting to write a shell script which will download the latest version of OpenOffice using wget, and then use the command-line to install the application. I have seen that installing the application is easy, but getting the latest version of OpenOffice is quite difficult.

Note: When I am referring to the latest version, I am not referring to 4.0.0 or 4.0.1, etc..., I am referring to whatever version of OO which is the latest at the time of install, without having to change the shell script.

I can use wget to fetch the latest from SourceForge:

wget http://sourceforge.net/projects/openofficeorg.mirror/files/latest/download

... however, it does not fetch the correct file.

Using the browser on Windows 7 x64 will fetch Apache_OpenOffice_4.0.0_Win_x86_install_en-US.exe, but wget will fetch OOo_3.3.0_Win_x86_install_en-US_20110219.iso.

How can I use wget to fetch the correct file?

Thank you for your time.

Note 2: wget on Linux fetches the same file.

share|improve this question
    
Have you used any other tools besides wget. Sounds like the best method would be to store the file you want to install on a network share and push updates to the file yourself. –  Ramhound Aug 13 '13 at 18:26

2 Answers 2

Use --user-agent parameter:

~ $ wget --user-agent="Mozilla/5.0 (X11; Linux x86_64; rv:23.0) Gecko/20100101 Firefox/23.0" http://sourceforge.net/projects/openofficeorg.mirror/files/latest/download

it will create download file that contains direct link. Now parse direct link and download tar.gz file:

~ $ wget `grep direct-download download | awk -F"href=." '{print $2}' | awk -F"\"" '{print $1}'`

It is not ideal way, but it is working :)

share|improve this answer

It's possible the windows version doesn't honour the redirect, you can try with the --max-redirect and/or -r (recursive) options to force it.

share|improve this answer

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.