Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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:

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.


#!/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

#! /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

You must log in to answer this question.