Wikiraum

Benutzer-Werkzeuge

Webseiten-Werkzeuge


Variante 1: Mit expect

openldap_install_01.sh
#!/bin/bash
aptitude update
aptitude install expect
 
VAR=$(expect -c '
spawn aptitude -y install slapd
expect "New password for the slapd \"root\" user:"
send "PasswordHere\r"
expect "Repeat password for the slapd \"root\" user:"
send "PasswordHere\r"
expect eof
')
 
echo "$VAR"
 
aptitude -y install slapd

Variante 2: Mit environment-Variable

openldap_install_02.sh
#!/bin/bash
 
installnoninteractive(){
  sudo bash -c "DEBIAN_FRONTEND=noninteractive aptitude install -q -y $*"
}
 
installnoninteractive slapd

Variante 3: Mit debconf

Man kann in der debconf-Datenbank Werte vordefinieren:

debconf-set-selections <<< 'slapd/password1 password secret'
debconf-show slapd
 slapd/internal/adminpw: (password omitted)
  slapd/internal/generated_adminpw: (password omitted)
* slapd/password1: (password omitted)
* slapd/password2: (password omitted)
  slapd/upgrade_slapcat_failure:
  slapd/dump_database_destdir: /var/backups/slapd-VERSION
  slapd/password_mismatch:
* slapd/no_configuration: false
  slapd/invalid_config: true
* slapd/allow_ldap_v2: false
* slapd/move_old_database: true
* shared/organization: organisation
  slapd/dump_database: when needed
* slapd/backend: HDB
* slapd/purge_database: false
* slapd/domain: domain.tld