# $Id: Portfile 56105 2009-08-24 07:18:34Z ryandesign@macports.org $

PortSystem		1.0

name			calife
version			3.0
categories		security
maintainers		sky.fr:cbellot
description		Provides super user privileges to specific users
long_description	Calife is a small utility close to sudo(8) but \
			lightweight and it preserves the caller's environment \
			(shell aliases, PATH and so on).
homepage		http://dev.keltia.net/projects/calife
master_sites		http://dev.keltia.net/attachments/download/4
platforms		darwin

use_bzip2		yes
checksums		md5 22cfd93b626cdf354483777e4e03d109
use_configure		yes

configure.args-append	--with-etcdir=${prefix}/etc

destroot {
  xinstall -m 755 -d ${destroot}${prefix}/bin
  xinstall -m 755 -d ${destroot}${prefix}/share/calife
  xinstall -m 755 -d ${destroot}${prefix}/share/man/man1
  xinstall -m 755 -d ${destroot}${prefix}/share/man/man5

  xinstall -m 4755 ${worksrcpath}/calife \
			${destroot}${prefix}/bin/calife
  xinstall -m 444 ${worksrcpath}/pam/macosx \
			${destroot}${prefix}/share/calife/pam.d-calife
  xinstall -m 600 ${worksrcpath}/calife.auth-dist \
			${destroot}${prefix}/etc
  xinstall -m 644 ${worksrcpath}/calife.1 \
			${destroot}${prefix}/share/man/man1
  xinstall -m 644 ${worksrcpath}/calife.auth.5 \
			${destroot}${prefix}/share/man/man5
}

post-destroot {
  ui_msg "--------------------------------------------------------------------"
  ui_msg "To use calife, you will have to MANUALLY :                          "
  ui_msg " - copy ${prefix}/share/calife/pam.d-calife as /etc/pam.d/calife    "
  ui_msg "   with this command :                                              "
  ui_msg "     sudo cp ${prefix}/share/calife/pam.d-calife /etc/pam.d/calife  "
  ui_msg " - edit ${prefix}/etc/calife-auth and give adequate permissions     "
  ui_msg "   (see man calife-auth or ${prefix}/etc/calife-auth-dist for syntax"
  ui_msg "--------------------------------------------------------------------"
}

