PortSystem		1.0

name			checkpassword-pam
version			0.99
revision		1
categories		security
license			GPL-2+
maintainers		nomaintainer
description		implementation of checkpassword-compatible auth program
long_description	checkpassword-pam was written from scratch. There \
					are several older packages called checkpassword-pam, \
					derived from DJB's checkpassword code. This \
					checkpassword-pam is more modern and \
					administrator-friendly.
homepage		http://checkpasswd-pam.sourceforge.net/
master_sites	sourceforge:project/checkpasswd-pam/checkpasswd-pam/${version}

checksums		md5 47db7b71f281115b030d4947f09f4374
platforms		darwin

patchfiles		patch-pam-support.c

configure.args	--mandir='${prefix}/share/man'
post-configure {
	file copy -force ${filespath}/check.sh.in ${worksrcpath}/check.sh
	reinplace "s|@PREFIX@|${prefix}|" ${worksrcpath}/check.sh
}

post-destroot {
	# Check if user is running as root
	if {[geteuid] == 0} {
		system "chmod 4511 ${destroot}${prefix}/bin/${name}"
	} else {
		ui_msg "-----------------------------------------------------------"
		ui_msg "Note that you are not running as root, so ${name}"
		ui_msg "cannot be installed setuid root. Therefore, it will only"
		ui_msg "be able to be executed by root."
		ui_msg "-----------------------------------------------------------"
		system "chmod 0511 ${destroot}${prefix}/bin/${name}"
	}
	xinstall -d -m 0755 ${destroot}${prefix}/share/doc/${name}
	xinstall -m 0644 -W ${worksrcpath} \
		AUTHORS COPYING INSTALL interface.html NEWS README \
		${destroot}${prefix}/share/doc/${name}
	xinstall -m 0755 check.sh ${destroot}${prefix}/share/doc/${name}/check.sh
	ui_msg "-----------------------------------------------------------"
	ui_msg "A sample check script has been provided here:\n"
	ui_msg "  ${prefix}/share/doc/${name}/check.sh\n"
	ui_msg "You can use this to verify that your PAM configuration"
	ui_msg "is correct for ${name} usage."
	ui_msg "-----------------------------------------------------------"
}
