# -*- coding: utf-8; mode: tcl; tab-width: 4; truncate-lines: t; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
# $Id: Portfile 64346 2010-03-03 13:54:12Z raimue@macports.org $

PortSystem          1.0

name                sudo
version             1.6.9p21
epoch               1
categories          sysutils security
maintainers         nomaintainer
description         Allow users to run programs as other users, eg, root
long_description \
    Sudo is a program designed to allow a sysadmin to give limited root \
    privileges to users and log root activity.  The basic philosophy is to \
    give as few privileges as possible but still allow people to get their \
    work done.

platforms           darwin

homepage            http://www.sudo.ws/sudo/
master_sites        ${homepage}dist/ \
                    ${homepage}dist/OLD/

checksums           md5     14515f4ef40e9390f9937afcea981895 \
                    sha1    a71c70ada7568293066f24f6123edf0fcd88cc0d \
                    rmd160  9364352145224aa9cf732fedccf9fda9b3a473fa

patchfiles      patch-sudoers.diff

configure.args  --infodir=${prefix}/share/info \
                --mandir=${prefix}/share/man \
                --sysconfdir=${prefix}/etc \
                --with-env-editor \
                --with-tty-tickets \
                --with-ignore-dot \
                --with-timedir=${prefix}/var/run/sudo \
                --disable-log-wrap \
                --with-password-timeout=0 \
                --disable-setreuid \
                --with-pam

pre-destroot {
    if { $env(USER) != "root" } {
        ui_msg "------------------------------------------------------------"
        ui_msg "Installing sudo as non-root doesn't really do anything"
        ui_msg "useful, so be sure to install sudo as root"
        ui_msg "------------------------------------------------------------"
    }
}

post-destroot {
    if {[file exists ${prefix}/etc/sudoers]} {
        file rename ${destroot}${prefix}/etc/sudoers ${destroot}${prefix}/etc/sudoers.dist
    }
    xinstall -d ${destroot}${prefix}/var/run/sudo
}
destroot.keepdirs ${destroot}${prefix}/var/run/sudo

post-install {
    ui_msg "------------------------------------------------------------"
    ui_msg "To complete installation run:"
    ui_msg "    ${prefix}/bin/sudo ${prefix}/sbin/visudo"
    ui_msg "Edit as necessary (see the"
    ui_msg "sudoers manpage for additional information)."
    ui_msg "------------------------------------------------------------"
}

variant insults description { It can only be attributed to human error. } {
    configure.args-append   --with-insults --with-all-insults
}

