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 creating a slient setup script on an ubuntu machine that also installs additional packages. one problem i am having is that the sun java package needs a manual confirmation of the license agreement. is there a chance that i can automate the installation so, that the process does not wait until i manually confirm the dialog?

share|improve this question

4 Answers 4

I believe the package asks about the license using Debconf. You can change what frontend debconf uses to ask you questions, or even set it to have no frontend, for unattended installs. Here's a quick article about it:

http://www.debianadmin.com/debconf-debian-configuration-management-system.html

share|improve this answer

I automate most program installations on Unix and Unix-like systems using Expect scripts. Expect is targeted at interacting with other programs via scripts and these are very easy to write.

example:

#!/usr/bin/expect -f
sudo apt-get install sun-java6-jre
expect "Password:"
sleep 1
send -- "mypassword\r"
expect "[y/n]"
sleep 1
send -- "yes\r"
share|improve this answer
    
Improvement edit war! haha! Beat you to it by 2 mins though =D –  BloodPhilia Jun 28 '10 at 18:19

Switching front end only suppresses the question - it still needs to be told. This blog post covers it nicely.

share|improve this answer

When using a shell script, try using send and expect. Make sure you have them installed. Also check out http://www.manpagez.com/man/1/expect/.

#! /usr/bin/expect -f

apt-get install sun-java6-jre
expect "[y/n]"
sleep 1
send "y\r"

This script calls the installer and then waits for it to output "[y/n]". When this is outputted, the script continues after 1 sec sleep by sending "y" along with a new line "\r".

share|improve this answer

Your Answer

 
discard

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