Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 156485
Collapse All | Expand All

(-)/root/nss_ldap-253.ebuild (+42 lines)
Lines 68-70 Link Here
68
		COPYING CVSVersionInfo.txt README nsswitch.ldap certutil
68
		COPYING CVSVersionInfo.txt README nsswitch.ldap certutil
69
	docinto docs; dodoc doc/*
69
	docinto docs; dodoc doc/*
70
}
70
}
71
72
pkg_postinst() {
73
	elog "You can use emerge --config =${PF} to automatically add"
74
	elog "ldap to your ${ROOT}etc/nsswitch.conf"
75
}
76
77
pkg_config() {
78
	local ns=${ROOT}etc/nsswitch.conf
79
	cp "${ns}" "${T}" || die "Could not copy ${ns} to ${T}"
80
	local nst="${T}/nsswitch.conf"
81
82
	einfo "Configuring passwd shadow and group databases to use ldap."
83
	einfo "If you want to use ldap for other uses, please configure"
84
	einfo "${ns} manually."
85
	einfo ""
86
87
	for var in passwd shadow group; do
88
		local match=$(egrep "^${var}:.*ldap" "${nst}")
89
		if [[ -z "${match}" ]]; then
90
			sed -e "s/^${var}:.*/& ldap/" -i "${nst}"
91
		else
92
			eerror "Ldap already found:"
93
			eerror "${match}"
94
		fi	
95
	done
96
97
	diff -u "${ns}" "${nst}"
98
99
	einfo ""
100
	einfo "Use the new file?"
101
	einfo "Please note that if your ${ROOT}etc/ldap.conf is not"
102
	einfo "setup correctly this might cause slowdowns in the usage"
103
	einfo "of the configured databases."
104
	einfo "[yes/edit/no]"
105
	read answer
106
107
	case "${answer}" in
108
		yes ) cp -v ${nst} ${ns};;
109
		edit ) ${EDITOR} ${nst} && cp -v ${nst} ${ns};;
110
		* ) einfo "${ns} not modified";;
111
	esac
112
}

Return to bug 156485