Merge pull request #2 from zamentur/vagrant_compatibility

This commit is contained in:
julienmalik 2015-09-29 00:12:22 +02:00
commit bb2a8bf302

View file

@ -97,7 +97,7 @@ upgrade_system() {
installscript_dependencies() { installscript_dependencies() {
# install dependencies of the install script itself # install dependencies of the install script itself
apt_get_wrapper -o Dpkg::Options::="--force-confold" \ apt_get_wrapper -o Dpkg::Options::="--force-confold" \
-y install \ -y --force-yes install \
lsb-release wget whiptail \ lsb-release wget whiptail \
|| return 1 || return 1
} }
@ -128,13 +128,6 @@ EOF
fi fi
} }
set_domain() {
# Configure hostname to yunohost.yunohost.org if not already set
# NOTE: This is done also during postinstall "to avoid amavis bug"
# so we might not need it here
[[ "$(hostname -d 2>/dev/null)" != "" ]] || hostname yunohost.yunohost.org > /dev/null 2>&1
}
confirm_installation() { confirm_installation() {
[[ "$AUTOMODE" == "1" ]] && return 0 [[ "$AUTOMODE" == "1" ]] && return 0
@ -180,7 +173,7 @@ apt_update() {
register_debconf() { register_debconf() {
if [[ $(lsb_release -c | awk '{print $2}') == jessie ]]; if [[ $(lsb_release -c | awk '{print $2}') == jessie ]];
then then
cat << EOF > debconf-set-selections debconf-set-selections << EOF
slapd slapd/password1 password yunohost slapd slapd/password1 password yunohost
slapd slapd/password2 password yunohost slapd slapd/password2 password yunohost
slapd slapd/domain string yunohost.org slapd slapd/domain string yunohost.org
@ -201,7 +194,7 @@ nslcd nslcd/ldap-base string dc=yunohost,dc=org
libnss-ldapd libnss-ldapd/nsswitch multiselect group, passwd, shadow libnss-ldapd libnss-ldapd/nsswitch multiselect group, passwd, shadow
EOF EOF
else else
cat << EOF > debconf-set-selections debconf-set-selections << EOF
slapd slapd/password1 password yunohost slapd slapd/password1 password yunohost
slapd slapd/password2 password yunohost slapd slapd/password2 password yunohost
slapd slapd/domain string yunohost.org slapd slapd/domain string yunohost.org
@ -246,7 +239,7 @@ workaround_avahi_installation() {
# 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)) local avahi_id=$((500 + RANDOM % 500))
while ! cut -d ':' -f 3 /etc/passwd | grep -q $avahi_id ; while cut -d ':' -f 3 /etc/passwd | grep -q $avahi_id ;
do do
avahi_id=$((500 + RANDOM % 500)) avahi_id=$((500 + RANDOM % 500))
done done
@ -264,7 +257,7 @@ workaround_avahi_installation() {
install_yunohost_packages() { install_yunohost_packages() {
apt_get_wrapper \ apt_get_wrapper \
-o Dpkg::Options::="--force-confold" \ -o Dpkg::Options::="--force-confold" \
-y install \ -y --force-yes install \
yunohost yunohost-config \ yunohost yunohost-config \
yunohost-config-postfix \ yunohost-config-postfix \
postfix postfix-ldap \ postfix postfix-ldap \
@ -274,8 +267,8 @@ install_yunohost_packages() {
restart_services() { restart_services() {
service slapd restart service slapd restart
# service yunohost-firewall start # service yunohost-firewall start
# service nscd restart service nscd restart
# service nslcd restart service nslcd restart
# NOTE : We don't fail if slapd fails to restart... # NOTE : We don't fail if slapd fails to restart...
return 0 return 0
@ -389,40 +382,36 @@ if ! step create_custom_config ; then
die "Creating custom configuration file /etc/yunohost/yunohost.conf failed" 4 die "Creating custom configuration file /etc/yunohost/yunohost.conf failed" 4
fi fi
if ! step set_domain ; then
die "Setting hostname failed" 5
fi
if ! step confirm_installation ; then if ! step confirm_installation ; then
die "Installation cancelled at your request" 6 die "Installation cancelled at your request" 5
fi fi
if ! step setup_package_source ; then if ! step setup_package_source ; then
die "Setting up deb package sources failed" 7 die "Setting up deb package sources failed" 6
fi fi
if ! step apt_update ; then if ! step apt_update ; then
die "Error caught during 'apt-get update'" 8 die "Error caught during 'apt-get update'" 7
fi fi
if ! step register_debconf ; then if ! step register_debconf ; then
die "Unable to insert new values into debconf database" 9 die "Unable to insert new values into debconf database" 8
fi fi
if ! step workaround_avahi_installation ; then if ! step workaround_avahi_installation ; then
die "Unable to install workaround for avahi installation" 10 die "Unable to install workaround for avahi installation" 9
fi fi
if ! step install_yunohost_packages ; then if ! step install_yunohost_packages ; then
die "Installation of Yunohost packages failed" 11 die "Installation of Yunohost packages failed" 10
fi fi
if ! step restart_services ; then if ! step restart_services ; then
die "Error caught during services restart" 12 die "Error caught during services restart" 11
fi fi
if ! step post_install ; then if ! step post_install ; then
die "Post-installation failed" 13 die "Post-installation failed" 12
fi fi
# Success ! # Success !