Installing packages that require user intervention

4 views
Skip to first unread message

ronen

unread,
Nov 1, 2009, 5:03:32 PM11/1/09
to AutomateIt
Is it possible to provide user interaction for packages like sun-java6-
jdk that require the user to approve a license, at the moment
automateIt fails to install such packages.

Ronen

Igal Koshevoy

unread,
Nov 1, 2009, 5:38:20 PM11/1/09
to autom...@googlegroups.com
I'm assuming this is happening on an "apt"-based system, like Debian or
Ubuntu....

The short answer is that you can use this somewhat ugly recipe:
http://github.com/igal/osbp_automateit/blob/master/recipes/base_java.rb

The long answer is that the Java package relies on debconf settings to
determine if you accepted its license. I've only ever run into this with
the Java package.

If this is a more wide-spread issue that affects more packages, it may
make sense to add methods to provide an interface to this, e.g.:

package_manager.debconf_set_selection("sun-java6-jdk",
"shared/accepted-sun-dlj-v1-1" => "boolean true")

An alternative solution to these annoying situations is to write your
own wrapper for installing this one misbehaving package using a tool
like "Expect" and call it from AutomateIt.

-igal

ronen

unread,
Nov 1, 2009, 6:23:43 PM11/1/09
to AutomateIt
I'm afraid that there are more cases like this (for example
http://www.bisigi-project.org/?lang=en), I guess that some form of an
gesture agent is a must in this case.
Another issue that Iv stumbled upon relates to gpg keys:

sh 'gpg --keyserver hkp://keyserver.ubuntu.com:11371 --recv-key
881574DE && gpg -a --export 881574DE | sudo apt-key add'

Under Ubuntu this works when running automateIt with the current user,
the following recipe require sudo user (iv ommited the sources.list
edit & the apt update):

sh 'gpg --keyserver hkp://keyserver.ubuntu.com:11371 --recv-key
881574DE && gpg -a --export
881574DE | sudo apt-key add'

package_manager.install('some_package')

Running it with sudo permission (sudo automateIt) will make gpg
unhappy (something with current user not owner of ~/.gnupg/gnu.conf),
the only solution that I can think of is some how enable different
parts of the recipe run with different users.

Id like to thank you for a cool & useful framework!
Looking forward to learn more about it
Ronen

Igal Koshevoy

unread,
Nov 2, 2009, 12:52:53 PM11/2/09
to autom...@googlegroups.com
On Sun, Nov 1, 2009 at 3:23 PM, ronen <nar...@gmail.com> wrote:
> Another issue that Iv stumbled upon relates to gpg keys:
>
> sh 'gpg --keyserver hkp://keyserver.ubuntu.com:11371 --recv-key
> 881574DE && gpg -a --export 881574DE | sudo apt-key add'
>
> Under Ubuntu this works when running automateIt with the current user,
> the following recipe require sudo user (iv ommited the sources.list
> edit & the apt update):
>
> sh 'gpg --keyserver hkp://keyserver.ubuntu.com:11371 --recv-key
> 881574DE && gpg -a --export 881574DE | sudo apt-key add'
>
> package_manager.install('some_package')
>
> Running it with sudo permission (sudo automateIt) will make gpg
> unhappy (something with current user not owner of ~/.gnupg/gnu.conf),
> the only solution that I can think of is some how enable different
> parts of the recipe run with different users.
This seems to be an issue with how gpg behaves under sudo, and not automateit.

My guess is that sudo imports some of your non-root user's environment
variables, like HOME, and gpg is then trying to use these
unsuccessfully. I recommend trying to figure out what environmental
variables gpg is trying to use and set them in your sudo'ed shell. If
you can figure out how to trick it into working, please post the
solution.

On my system, I was able to import the key by doing one of these:

1. Create an AutomateIt recipe like this, note the "-- -" at the end
of "apt-key" instructions which my system required:
sh "gpg --keyserver hkp://keyserver.ubuntu.com:11371 --recv-key
881574DE && gpg -a --export 881574DE | apt-key add -- -"

Execute the recipe with a command that sets the HOME variable for the
initial sudo:
HOME=/root sudo automateit myrecipe.rb

2. Or set the HOME variable inside the "sh" command:
sh "export HOME=/root; gpg --keyserver
hkp://keyserver.ubuntu.com:11371 --recv-key 881574DE && gpg -a
--export 881574DE | apt-key add -- -"

And executing it like:
sudo automateit myrecipe.rb

> Id like to thank you for a cool & useful framework!
> Looking forward to learn more about it
Thanks!

-igal
Reply all
Reply to author
Forward
0 new messages