1

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?

4 Answers 4

2

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

1

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"
1
  • Improvement edit war! haha! Beat you to it by 2 mins though =D
    – Pylsa
    Jun 28, 2010 at 18:19
0

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

0

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".

You must log in to answer this question.