8

When installing gitolite I find that:

# aptitude install gitolite
The following NEW packages will be installed:
  gitolite 
0 packages upgraded, 1 newly installed, 0 to remove and 29 not upgraded.
Need to get 114 kB of archives. After unpacking 348 kB will be used.
Get:1 http://security.debian.org/ squeeze/updates/main gitolite all 1.5.4-2+squeeze1 [114 kB]
Fetched 114 kB in 0s (202 kB/s)
Preconfiguring packages ...
Selecting previously deselected package gitolite.
(Reading database ... 30593 files and directories currently installed.)
Unpacking gitolite (from .../gitolite_1.5.4-2+squeeze1_all.deb) ...
Setting up gitolite (1.5.4-2+squeeze1) ...
No adminkey given - not initializing gitolite in /var/lib/gitolite.

The last line is of interest to me. If I run dpkg-reconfigure -plow gitolite I am presented with a dialog and can modify:

  • the system user name for gitolite,
  • the location of the gitolite repositories and
  • provide the admin pubkey.

I'd prefer to use the git system user and provide the admin pubkey on installation, say something of the sort:

# aptitude install gitolite --user git --admin-pubkey 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDAc7kCAi2WkvqpAL1fK1sIw6xjpatJ+Ms2nrwLJPhdovEY3MPZF7mtH+rv1CHFDn66fLGiWevOFp...'

That, of course, doesn't work. Can something similar be done? How do I determine the configuration parameters ahead of time? This would be remarkably useful, for instance, when installing gitolite automatically, via puppet or chef.

troutwine
  • 1,382
  • 5
  • 16
  • 32

3 Answers3

14

I haven't tested this, but I believe that after you run your dpkg-reconfigure on an example machine, you can run debconf-get-selections | egrep "^gitolite\s" to get what was set. (it's in the debconf-utils package if you don't have it).

Then on the CLI, debconf-set-selections $FILENAME before running apt.

Then with puppet it would be something like:

file {
  "/var/cache/debconf/gitolite.preseed":
     source => '...'; # someplace with that output
}
package {
  "gitolite":
    require      => File["/var/cache/debconf/gitolite.preseed"],
    responsefile => "/var/cache/debconf/gitolite.preseed";
}

More info on puppet's site:

I suspect Chef has a similar mechanism for specifying a responsefile or preseed file or something like that, but I'm not a Chef user.

рüффп
  • 620
  • 1
  • 11
  • 24
freiheit
  • 14,334
  • 1
  • 46
  • 69
5

You need to provide a preseed to work around this. See how it is done for Java in this module. I find that the easiest way to get a preseed file is to do a manual installation and configuration first, and then getting the seed from that. This blog has a good example of this.

Reaces
  • 5,547
  • 4
  • 36
  • 46
Daniel C. Sobral
  • 5,563
  • 5
  • 32
  • 48
0

I was searching for a way to do this with the ttf-mscorefonts-installer package on Ubuntu. Using the above instructions came up with this puppet recipe:

        # this is a preseed file which makes it answer the accept EULA when it asks
        # got this content this way: apt install debconf-utils and then run this: debconf-get-selections | grep ttf-mscorefonts-installer
        file {
          "/var/cache/debconf/ttf-mscorefonts-installer.preseed":
             content => "\
ttf-mscorefonts-installer       msttcorefonts/baddldir  error\n\
ttf-mscorefonts-installer       msttcorefonts/dldir     string\n\
ttf-mscorefonts-installer       msttcorefonts/present-mscorefonts-eula  note\n\
ttf-mscorefonts-installer       msttcorefonts/accepted-mscorefonts-eula boolean true\n\
ttf-mscorefonts-installer       msttcorefonts/error-mscorefonts-eula    error\n\
ttf-mscorefonts-installer       msttcorefonts/dlurl     string\n"
             
        }
        package { "ttf-mscorefonts-installer":
            ensure => installed,
            require      => File["/var/cache/debconf/ttf-mscorefonts-installer.preseed"],
            responsefile => "/var/cache/debconf/ttf-mscorefonts-installer.preseed"
        }

    
sjbotha
  • 305
  • 4
  • 8