From owner-freebsd-ports-bugs@FreeBSD.ORG Mon Jul 16 20:50:12 2012 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AF5871065674 for ; Mon, 16 Jul 2012 20:50:12 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 89B198FC16 for ; Mon, 16 Jul 2012 20:50:12 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q6GKoCQ8081579 for ; Mon, 16 Jul 2012 20:50:12 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q6GKoC1t081578; Mon, 16 Jul 2012 20:50:12 GMT (envelope-from gnats) Resent-Date: Mon, 16 Jul 2012 20:50:12 GMT Resent-Message-Id: <201207162050.q6GKoC1t081578@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Bryan Drewery Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C3554106564A for ; Mon, 16 Jul 2012 20:44:59 +0000 (UTC) (envelope-from bryan@shatow.net) Received: from secure.xzibition.com (secure.xzibition.com [173.160.118.92]) by mx1.freebsd.org (Postfix) with ESMTP id 6C9BB8FC15 for ; Mon, 16 Jul 2012 20:44:59 +0000 (UTC) Received: (qmail 95926 invoked from network); 16 Jul 2012 15:44:51 -0500 Received: from unknown (HELO test8.xzibition.com) (10.10.0.34) by sweb.xzibition.com with SMTP; 16 Jul 2012 15:44:51 -0500 Received: by test8.xzibition.com (sSMTP sendmail emulation); Mon, 16 Jul 2012 15:44:45 -0500 Message-Id: <20120716204459.C3554106564A@hub.freebsd.org> Date: Mon, 16 Jul 2012 15:44:45 -0500 From: "Bryan Drewery" To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: ports/169918: [PATCH] net-mgmt/nrpe2: Support USERS/GROUPS X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Bryan Drewery List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2012 20:50:12 -0000 >Number: 169918 >Category: ports >Synopsis: [PATCH] net-mgmt/nrpe2: Support USERS/GROUPS >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Mon Jul 16 20:50:12 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Bryan Drewery >Release: FreeBSD 8.3-RELEASE i386 >Organization: >Environment: >Description: Adds proper USERS/GROUPS support without the need for interactive asking during install. Also removes redundant notices on deinstall already hanelded by bsd.port.mk. >How-To-Repeat: >Fix: --- patch-nrpe2-USERS-GROUPS.txt begins here --- diff -ur /usr/ports/net-mgmt/nrpe2.orig/Makefile ./Makefile --- /usr/ports/net-mgmt/nrpe2.orig/Makefile 2012-07-16 15:37:21.000000000 -0500 +++ ./Makefile 2012-07-16 15:42:12.000000000 -0500 @@ -30,6 +30,8 @@ NAGIOSUSER?= nagios NAGIOSGROUP?= nagios NAGIOSDIR?= /var/spool/nagios +USERS= ${NAGIOSUSER} +GROUPS= ${NAGIOSGROUP} NAGIOSUID= 181 NAGIOSGID= ${NAGIOSUID} diff -ur /usr/ports/net-mgmt/nrpe2.orig/files/pkg-deinstall.in ./files/pkg-deinstall.in --- /usr/ports/net-mgmt/nrpe2.orig/files/pkg-deinstall.in 2012-07-16 15:37:21.000000000 -0500 +++ ./files/pkg-deinstall.in 2012-07-16 15:42:08.000000000 -0500 @@ -4,18 +4,8 @@ # NAGIOSDIR=%%NAGIOSDIR%% -NAGIOSUSER=%%NAGIOSUSER%% -NAGIOSGROUP=%%NAGIOSGROUP%% if [ "$2" = "POST-DEINSTALL" ]; then - if /usr/sbin/pw group show "${NAGIOSGROUP}" 2>&1 >/dev/null; then - echo "You should manually remove the \"${NAGIOSGROUP}\" group." - fi - - if /usr/sbin/pw user show "${NAGIOSUSER}" 2>&1 >/dev/null; then - echo "You should manually remove the \"${NAGIOSUSER}\" user." - fi - if [ -e "${NAGIOSDIR}" ]; then echo "You should manually remove the \"${NAGIOSDIR}\" directory." fi diff -ur /usr/ports/net-mgmt/nrpe2.orig/files/pkg-install.in ./files/pkg-install.in --- /usr/ports/net-mgmt/nrpe2.orig/files/pkg-install.in 2012-07-16 15:37:21.000000000 -0500 +++ ./files/pkg-install.in 2012-07-16 15:39:12.000000000 -0500 @@ -9,69 +9,7 @@ NAGIOSUID=%%NAGIOSUID%% NAGIOSGID=%%NAGIOSGID%% -ask() { - local question default answer - - question=$1 - default=$2 - if [ -z "${PACKAGE_BUILDING}" ]; then - read -p "${question} [${default}]? " answer - fi - if [ "x${answer}" = "x" ]; then - answer=${default} - fi - echo ${answer} -} - -yesno() { - local default question answer - - question=$1 - default=$2 - while :; do - answer=$(ask "${question}" "${default}") - case "${answer}" in - [Yy][Ee][Ss]|[Yy]) - return 0 - ;; - [Nn][Oo]|[Nn]) - return 1 - ;; - esac - echo "Please answer yes or no." - done -} - -if [ "$2" = "PRE-INSTALL" ]; then - if /usr/sbin/pw group show "${NAGIOSGROUP}" 2>&1 >/dev/null; then - echo "You already have a \"${NAGIOSGROUP}\" group, so I will use it." - else - echo "You need a \"${NAGIOSGROUP}\" group." - if yesno "Would you like me to create it" "YES"; then - /usr/sbin/pw groupadd "${NAGIOSGROUP}" -g "${NAGIOSGID}" -h - || \ - /usr/sbin/pw groupadd "${NAGIOSGROUP}" -h - || exit - echo "Done." - else - echo "Please create the \"${NAGIOSGROUP}\" group manually and try again." - exit 1 - fi - fi - - if /usr/sbin/pw user show "${NAGIOSUSER}" 2>&1 >/dev/null; then - echo "You already have a \"${NAGIOSUSER}\" user, so I will use it." - else - echo "You need a \"${NAGIOSUSER}\" user." - if yesno "Would you like me to create it" "YES"; then - /usr/sbin/pw useradd "${NAGIOSUSER}" -u "${NAGIOSUID}" -g "${NAGIOSGROUP}" -h - -d "${NAGIOSDIR}" \ - -s /sbin/nologin -c "Nagios pseudo-user" || \ - /usr/sbin/pw useradd "${NAGIOSUSER}" -g "${NAGIOSGROUP}" -h - -d "${NAGIOSDIR}" \ - -s /sbin/nologin -c "Nagios pseudo-user" || exit - else - echo "Please create the \"${NAGIOSUSER}\" user manually and try again." - exit 1 - fi - fi -elif [ "$2" = "POST-INSTALL" ]; then +if [ "$2" = "POST-INSTALL" ]; then if [ ! -e "${NAGIOSDIR}" ]; then /bin/mkdir -p "${NAGIOSDIR}" /bin/chmod 775 "${NAGIOSDIR}" --- patch-nrpe2-USERS-GROUPS.txt ends here --- >Release-Note: >Audit-Trail: >Unformatted: