2010-10-15 20:59:30 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2010-10-16 23:52:11 +02:00
|
|
|
_is_live() {
|
|
|
|
cdroot=$(cat /proc/cmdline | grep cdroot)
|
|
|
|
if [ -n "${cdroot}" ]; then
|
|
|
|
return 0
|
|
|
|
else
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2010-11-12 13:27:57 +01:00
|
|
|
_is_installer_mode() {
|
|
|
|
is_installer=$(cat /proc/cmdline | grep installer)
|
|
|
|
if [ -n "${is_installer}" ]; then
|
|
|
|
return 0
|
|
|
|
else
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2010-10-16 23:52:11 +02:00
|
|
|
_setup_fds_live() {
|
2010-10-15 20:59:30 +02:00
|
|
|
# setup 389-ds
|
|
|
|
tmp_config_file="$(mktemp)"
|
|
|
|
echo "[General]
|
2010-10-18 19:01:49 +02:00
|
|
|
FullMachineName=localhost.localdomain
|
2010-10-15 20:59:30 +02:00
|
|
|
SuiteSpotUserID=dirsrv
|
|
|
|
SuiteSpotGroup=dirsrv
|
|
|
|
ConfigDirectoryAdminPwd=mcsmanager
|
|
|
|
|
|
|
|
[slapd]
|
|
|
|
ServerPort=389
|
|
|
|
ServerIdentifier=sabayon
|
|
|
|
Suffix=dc=babel,dc=it
|
|
|
|
RootDN=cn=Directory Manager
|
|
|
|
RootDNPwd=mcsmanager
|
|
|
|
|
|
|
|
[admin]
|
|
|
|
Port=9830
|
|
|
|
SysUser=dirsrv
|
|
|
|
ServerIpAddress=127.0.0.1
|
|
|
|
ServerAdminID=admin
|
|
|
|
ServerAdminPwd=mcsmanager
|
|
|
|
" > "${tmp_config_file}"
|
2010-11-12 13:27:57 +01:00
|
|
|
|
2010-10-15 20:59:30 +02:00
|
|
|
su - -c "/usr/sbin/setup-ds-admin.pl -f ${tmp_config_file} --silent" || return 1
|
2010-10-19 19:41:55 +02:00
|
|
|
|
|
|
|
# init MCS ldap data
|
2010-10-22 17:24:48 +02:00
|
|
|
( /usr/sbin/mcs-ldapinit.pl -d localhost.localdomain -b "dc=babel,dc=it" \
|
|
|
|
-s sa -p mcsmanager -a node1 -B "db1,db2" -f /tmp/base.ldif ) || return 1
|
|
|
|
/usr/bin/ldapmodify -a -D "cn=directory manager" -h localhost -w mcsmanager \
|
|
|
|
-f /tmp/base.ldif || return 1
|
2010-10-19 19:41:55 +02:00
|
|
|
|
2010-10-15 20:59:30 +02:00
|
|
|
echo "389 Directory Server configured."
|
|
|
|
return 0
|
|
|
|
}
|
2010-10-16 23:52:11 +02:00
|
|
|
|
|
|
|
FDS_SETUP_FILE="/etc/.389-sabayon-configured"
|
|
|
|
|
|
|
|
_setup_fds_installed() {
|
|
|
|
if [ -e "${FDS_SETUP_FILE}" ]; then
|
|
|
|
return
|
|
|
|
fi
|
2010-11-12 13:27:57 +01:00
|
|
|
# First, setup 389, if not in installer mode
|
|
|
|
_is_installer_mode || _setup_fds_live
|
2010-10-16 23:52:11 +02:00
|
|
|
# then make it autostart at the next boot
|
|
|
|
rc-update add 389-ds default
|
|
|
|
rc-update add 389-admin default
|
|
|
|
# do the whole thing once
|
|
|
|
touch "${FDS_SETUP_FILE}"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
setup_fds() {
|
|
|
|
# setup 389
|
2010-10-20 19:49:10 +02:00
|
|
|
if _is_live; then
|
|
|
|
_setup_fds_live
|
|
|
|
else
|
|
|
|
_setup_fds_installed
|
|
|
|
fi
|
2010-10-16 23:52:11 +02:00
|
|
|
}
|