how to pass gitolite3 public-key on apt install command-line

Asked by Fuminori Ido

I would like to install gitolite3 via a provisioning tool (called "Itamae", which is similar to Capistrano). This tool requires non-interactive installation for all of packages.

In gitolite3 case, usual installtion via "sudo apt install gitolite3" requires gitolite3 admin ssh public key interactively, while I would like to know how to pass the ssh public key on the installation via non-interactive provisioning tool something like the following:

  $ sudo apt install gitolite3 --ssh-public-key /A/PATH/TO/GITOLITE3/SSH/PUBLIC-KEY

Could you let me know how to do that?

Thank you and Best Regards,

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu gitolite3 Edit question
Assignee:
No assignee Edit question
Solved by:
Fuminori Ido
Solved:
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

You can setup SSH keys for automatic logins. You can then allow people in the sudo group to use apt-get without password by configuring visudo.

Keep a root console open so that if you botch the file then you can can recover

Revision history for this message
Fuminori Ido (fuminori-ido) said :
#2

Thank you for your prompt reply. You mean setup SSH key after apt(8) installation, right? I understand that way, thank you.

By the way, Let me ask two more questions.

1) Could you let me know what is the installation script during installtion by apt(8) to register 'gitolite3' user in /etc/passwd by (maybe) adduser(8)?

2) When I install gitolite3 by apt(8) onto test PC, the UID is 130 and GID is 142. Is this automatically set so that the UID and GID could be vary for each installation PC envrionment? Or if the UID and GID is reserved for consistency, which installation script or configuration file specify those constant value?

Thank you and Best Regards,

Revision history for this message
Manfred Hampl (m-hampl) said :
#3

Most of the setup is done in the postinst script, e.g.

...
   adduser --quiet --system --home "$GITDIR" --shell /bin/bash \
    --no-create-home --gecos 'git repository hosting' \
    --group "$GITUSER"
...
with the value for GITUSER being looked up by debconf (if already set) or asked interactively.
Similar with the value for adminkey.

You could try using debconf-communicate or debconf-loadtemplate commands to pre-define the desired values.

Revision history for this message
Fuminori Ido (fuminori-ido) said :
#4

I understand the detail how package script runs. Thank you for your information