ports/147948: graphics/sane-backends and old interactive user/group add

David DEMELIER demelier.david at gmail.com
Thu Jun 17 18:40:05 UTC 2010


>Number:         147948
>Category:       ports
>Synopsis:       graphics/sane-backends and old interactive user/group add
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jun 17 18:40:04 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     David DEMELIER
>Release:        8.1-PRERELEASE
>Organization:
>Environment:
FreeBSD Melon.malikania.fr 8.1-PRERELEASE FreeBSD 8.1-PRERELEASE #8: Tue Jun 15 20:45:19 CEST 2010     root at Melon.malikania.fr:/usr/obj/usr/src/sys/Melon  amd64
>Description:
The graphics/sane-backends ports has an interactive way to add the  `saned' user and group. This is really painful because if you don't set BATCH the compilation will stops until the user has answered.

Because the ports infrastructure has a way to add users and group I decided to use it.

http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/users-and-groups.html
>How-To-Repeat:
cd graphics/sane-backends && make install
>Fix:
--- files/pkg-install.in	2010-02-07 21:34:20.000000000 +0100
+++ /dev/null	2010-06-17 20:11:00.000000000 +0200
@@ -1,65 +0,0 @@
-#!/bin/sh
-
-user=saned
-group=saned
-
-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 dflt question answer
-
-    question=$1
-    dflt=$2
-    while :; do
-        answer=$(ask "${question}" "${dflt}")
-        case "${answer}" in
-        [Yy]*)          return 0;;
-        [Nn]*)          return 1;;
-        esac
-        echo "Please answer yes or no."
-    done
-}
-
-if [ x"$2" = xPRE-INSTALL ]; then
-    if /usr/sbin/pw groupshow "${group}" 2>/dev/null; then
-        echo "You already have a group \"${group}\", so I will use it."
-    else
-        echo "You need a group \"${group}\"."
-        if ([ -n "$BATCH" ] || yesno "Would you like me to create it" y); then
-            /usr/sbin/pw groupadd ${group} -g 194 -h - || exit
-            echo "Done."
-        else
-            echo "Please create it, and try again."
-            exit 1
-        fi
-    fi
-
-    if /usr/sbin/pw user show "${user}" 2>/dev/null; then
-        echo "You already have a user \"${user}\", so I will use it."
-	pw usermod "${user}" -d /nonexistent
-    else
-        echo "You need a user \"${user}\"."
-        if ([ -n "$BATCH" ] || yesno "Would you like me to create it" y); then
-            /usr/sbin/pw useradd ${user} -u 194 -g ${group} -h - \
-                -d /nonexistent -s /bin/sh -c "SANE Scanner Daemon" || exit
-            echo "Done."
-        else
-            echo "Please create it, and try again."
-            exit 1
-        fi
-    fi
-
-    # TODO: Fix logging.
-fi
--- /usr/ports/GIDs.orig	2010-06-17 20:17:01.000000000 +0200
+++ /usr/ports/GIDs	2010-06-17 20:17:14.000000000 +0200
@@ -82,6 +82,7 @@
 noc:*:182:
 moinmoin:*:192:
 cups:*:193:
+saned:*:194:
 sympa:*:200:
 dspam:*:202:
 git:*:211:
--- /usr/ports/UIDs.orig	2010-06-17 20:18:22.000000000 +0200
+++ /usr/ports/UIDs	2010-06-17 20:18:42.000000000 +0200
@@ -90,6 +90,7 @@
 noc:*:182:182::0:0:NOC pseudo-user:/usr/local/noc:/bin/sh
 moinmoin:*:192:192::0:0:MoinMoin User:/nonexistent:/usr/sbin/nologin
 cups:*:193:193::0:0:Cups Owner:/nonexistent:/usr/sbin/nologin
+saned:*:194:194::0:0:SANE Scanner Daemon:/nonexistent:/bin/sh
 sympa:*:200:200::0:0:Sympa Owner:/nonexistent:/usr/sbin/nologin
 privoxy:*:201:201::0:0:Privoxy proxy user:/nonexistent:/usr/sbin/nologin
 dspam:*:202:202::0:0:Dspam:/nonexistent:/usr/sbin/nologin
--- Makefile.orig	2010-06-17 20:09:35.000000000 +0200
+++ Makefile	2010-06-17 20:20:56.000000000 +0200
@@ -42,7 +42,10 @@
 USE_LDCONFIG=	yes
 
 USE_RC_SUBR=	saned
-SUB_FILES+=	pkg-install pkg-message
+SUB_FILES+=	pkg-message
+
+USERS=	saned
+GROUPS=	saned
 
 .include "Makefile.man"
 .include <bsd.port.pre.mk>
@@ -95,10 +98,6 @@
 		 s|-lpthread|${PTHREAD_LIBS}|g' ${WRKSRC}/configure
 	@(cd ${WRKSRC}/po; ${BASENAME} -s .po `${LS} *.po` > LINGUAS)
 
-# Pass BATCH to pkg-install for Evil Things(tm)
-pre-install:
-	@BATCH="${BATCH}" ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
-
 post-install:
 	@${CAT} ${PKGMESSAGE}
 

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list