Integrate the debconf settings into the script to make it self-supporting

This commit is contained in:
Julien Malik 2015-09-06 23:11:19 +02:00
parent 97234cfced
commit edbde8450a

View file

@ -172,9 +172,44 @@ apt_update() {
register_debconf() {
if [[ $(lsb_release -c | awk '{print $2}') == jessie ]];
then
debconf-set-selections "$(this_script_path)/debconfjessie"
cat << EOF > debconf-set-selections
slapd slapd/password1 password yunohost
slapd slapd/password2 password yunohost
slapd slapd/domain string yunohost.org
slapd shared/organization string yunohost.org
slapd slapd/allow_ldap_v2 boolean false
slapd slapd/invalid_config boolean true
slapd slapd/backend select MDB
postfix postfix/main_mailer_type select Internet Site
postfix postfix/mailname string /etc/mailname
mysql-server-5.5 mysql-server/root_password password yunohost
mysql-server-5.5 mysql-server/root_password_again password yunohost
nslcd nslcd/ldap-bindpw password
nslcd nslcd/ldap-starttls boolean false
nslcd nslcd/ldap-reqcert select
nslcd nslcd/ldap-uris string ldap://localhost/
nslcd nslcd/ldap-binddn string
nslcd nslcd/ldap-base string dc=yunohost,dc=org
libnss-ldapd libnss-ldapd/nsswitch multiselect group, passwd, shadow
EOF
else
debconf-set-selections "$(this_script_path)/debconfv2"
cat << EOF > debconf-set-selections
slapd slapd/password1 password yunohost
slapd slapd/password2 password yunohost
slapd slapd/domain string yunohost.org
slapd shared/organization string yunohost.org
postfix postfix/main_mailer_type select Internet Site
postfix postfix/mailname string /etc/mailname
mysql-server-5.5 mysql-server/root_password password yunohost
mysql-server-5.5 mysql-server/root_password_again password yunohost
nslcd nslcd/ldap-bindpw password
nslcd nslcd/ldap-starttls boolean false
nslcd nslcd/ldap-reqcert select
nslcd nslcd/ldap-uris string ldap://localhost/
nslcd nslcd/ldap-binddn string
nslcd nslcd/ldap-base string dc=yunohost,dc=org
libnss-ldapd libnss-ldapd/nsswitch multiselect group, passwd, shadow
EOF
fi
}
@ -184,21 +219,21 @@ workaround_avahi_installation() {
# with a light VM system like LXC
# we hit a bug with avahi-daemon postinstallation
# This is described in detail in https://github.com/lxc/lxc/issues/25
#
#
# It makes the configure step of avahi-daemon fail, because the service does
# start correctly. Then all other packages depending on avahi-daemon refuse to
# configure themselves.
#
#
# The workaround we use is to generate a random uid for the avahi user, and
# create the user with this id beforehand, so that the avahi-daemon postinst
# script does not do it on its own. Our randomized uid has far less chances to
# be already in use in another system than the automated one (which tries to use
# consecutive uids).
# Return without error if avahi already exists
id avahi > /dev/null 2>&1 || return 0
# Get a random unused uid between 500 and 999 (system-user)
# Get a random unused uid between 500 and 999 (system-user)
local avahi_id=$((500 + RANDOM % 500))
while ! cut -d ':' -f 3 /etc/passwd | grep -q $avahi_id ;
do
@ -261,7 +296,7 @@ Do you want to proceed with YunoHost post-installation now?
|| return 0
/usr/bin/yunohost tools postinstall
local POSTINSTALL_EXIT_CODE="$?"
while [[ "$POSTINSTALL_EXIT_CODE" != "0" ]] ;
do
@ -276,7 +311,7 @@ Do you want to try again now?
/usr/bin/yunohost tools postinstall
POSTINSTALL_EXIT_CODE="$?"
done
return 0
return 0
}
# Treat unset variables as an error when performing
@ -289,7 +324,7 @@ if ! ensure_root ; then
fi
if ! installscript_dependencies ; then
die "Unable to install dependencies to install script" 2
die "Unable to install dependencies to install script" 2
fi
if ! create_custom_config ; then
@ -339,4 +374,3 @@ fi
# Success !
success
exit 0