ports/157593: [PATCH] Fix port: devel/fossology should use USERS
Chris Rees
utisoft at gmail.com
Sat Jun 4 09:50:11 UTC 2011
>Number: 157593
>Category: ports
>Synopsis: [PATCH] Fix port: devel/fossology should use USERS
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Sat Jun 04 09:50:10 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator: Chris Rees
>Release: FreeBSD 8.2-RELEASE-p1 i386
>Organization:
bayofrum
>Environment:
System: FreeBSD zeus.bayofrum.net 8.2-RELEASE-p1 FreeBSD 8.2-RELEASE-p1 #0: Sat Apr 30 15:09:06 BST 2011 root at zeus.bayofrum.net:/usr/obj/usr/src/sys/ZEUS i386
>Description:
This port uses pkg-install to create new users instead of using USERS= and GROUPS=
I've attached the most likely fix, however I've been unable to tinderbox it because it's marked BROKEN. I will send an email out to ports@ to see if anyone's interested otherwise it should be deprecated.
>How-To-Repeat:
>Fix:
- Use USERS and GROUPS
Submitted by: Chris Rees (utisoft at gmail.com)
--- devel-fossology.patch begins here ---
Index: Makefile
===================================================================
RCS file: /exports/cvsroot-freebsd/ports/devel/fossology/Makefile,v
retrieving revision 1.7
diff -u -r1.7 Makefile
--- Makefile 2 May 2011 12:44:31 -0000 1.7
+++ Makefile 2 Jun 2011 14:18:42 -0000
@@ -40,6 +40,8 @@
BROKEN= does not compile
+USERS= fossy
+GROUPS= ${USERS}
USE_APACHE= 2.0+
USE_CDRTOOLS= yes
USE_GMAKE= yes
Index: files/patch-common__fo-postinstall.in
===================================================================
RCS file: /exports/cvsroot-freebsd/ports/devel/fossology/files/patch-common__fo-postinstall.in,v
retrieving revision 1.1
diff -u -r1.1 patch-common__fo-postinstall.in
--- files/patch-common__fo-postinstall.in 24 Jul 2009 06:30:56 -0000 1.1
+++ files/patch-common__fo-postinstall.in 2 Jun 2011 14:17:01 -0000
@@ -1,100 +1,116 @@
---- common/fo-postinstall.in.orig 2009-07-13 21:51:17.000000000 +0000
-+++ common/fo-postinstall.in 2009-07-15 00:37:37.000000000 +0000
-@@ -8,22 +8,15 @@
+--- common/fo-postinstall.in 2011-06-02 15:16:35.611277082 +0100
++++ common/fo-postinstall.in.orig 2011-06-02 15:12:07.679891820 +0100
+@@ -7,14 +7,23 @@
+ # idempotent, meaning that running it repeatedly will still do the
# right thing, regardless of the success of previous runs.
- ## Options parsing and setup
--# parse options
--OPTS=`getopt -o adwseoh --long agent,database,web,web-only,scheduler,scheduler-only,everything,overwrite,help -n 'fo-postinstall' -- "$@"`
-
--if [ $? != 0 ]; then
-- echo "ERROR: Bad option specified."
-- OPTS="--help"
--fi
--
--eval set -- "$OPTS"
-+# FIXME: joint options do not work (i.e. "-as" instead of "-a -s")
+-# FIXME: joint options do not work (i.e. "-as" instead of "-a -s")
++## Options parsing and setup
++# parse options
++OPTS=`getopt -o adwseoh --long agent,database,web,web-only,scheduler,scheduler-only,everything,overwrite,help -n 'fo-postinstall' -- "$@"`
++
++if [ $? != 0 ]; then
++ echo "ERROR: Bad option specified."
++ OPTS="--help"
++fi
++
++eval set -- "$OPTS"
# if no options or just -o then do everything
--if [ "$OPTS" = " --" -o "$OPTS" = " -o --" ]; then
-+if [ $# -eq 0 -o "$1" = "-o" ]; then
+-if [ $# -eq 0 -o "$1" = "-o" ]; then
++if [ "$OPTS" = " --" -o "$OPTS" = " -o --" ]; then
EVERYTHING=1
fi
--while true; do
-+while [ $# -gt 0 ]; do
+-while [ $# -gt 0 ]; do
++while true; do
case "$1" in
-a|--agent) AGENT=1; shift;;
-d|--database) DATABASE=1; shift;;
-@@ -105,15 +98,10 @@
- echo "*** Creating user and group ***"
+@@ -93,12 +102,53 @@
+ # documentation.
- # check for group
-- if grep -q "^{$PROJECTGROUP}:" /etc/group; then
-+ if pw groupshow {$PROJECTGROUP} 2>/dev/null 1>&2; then
- echo "NOTE: group '{$PROJECTGROUP}' already exists, good."
- else
-- # use addgroup if it exists since it supports --system
-- if [ -f /usr/sbin/addgroup -a ! -L /usr/sbin/addgroup ]; then
-- addgroup --system {$PROJECTGROUP}
-- else
-- groupadd {$PROJECTGROUP}
-- fi
-+ pw groupadd {$PROJECTGROUP} -g 901
- if [ "$?" != "0" ] ; then
- echo "ERROR: Unable to create group '{$PROJECTGROUP}'"
- exit 1
-@@ -123,25 +111,18 @@
- fi
-
- # check for user
-- if grep -q "^{$PROJECTUSER}:" /etc/passwd; then
-+ if pw usershow {$PROJECTUSER} 2>/dev/null 1>&2; then
- echo "NOTE: user '{$PROJECTUSER}' already exists, good."
- USERSHELL=`grep "^{$PROJECTUSER}:" /etc/passwd |cut -d: -f 7`
-- if [ "$USERSHELL" = "/bin/false" ]; then
-+ if [ "$USERSHELL" = "/usr/sbin/nologin" ]; then
- echo "ERROR: {$PROJECTUSER} shell must be a real shell"
- exit 1
- fi
- else
- # ensure that the full parent path of the HOME exists first
- mkdir -p $\{REPO%/*/*\}
-- # use adduser if it exists since it supports --system, but
-- # not if it's a symlink (probably to /usr/sbin/useradd)
-- if [ -f /usr/sbin/adduser -a ! -L /usr/sbin/adduser ]; then
-- adduser --gecos "{$PROJECT}" --ingroup {$PROJECTGROUP} --system \
-- --shell /bin/bash --home "$\{REPO%/*\}" {$PROJECTUSER}
-- else
-- useradd -c "{$PROJECT}" -g {$PROJECTGROUP} -m \
-- -s /bin/bash -d "$\{REPO%/*\}" {$PROJECTUSER}
-- fi
-+ pw useradd {$PROJECTUSER} -u 901 -g {$PROJECTGROUP} -h - \
-+ -s "/bin/bash" -d "$\{REPO%/*\}" -c "FOSSology user"
- if [ "$?" != "0" ] ; then
- echo "ERROR: Unable to create user '{$PROJECTUSER}'"
- exit 1
-@@ -284,19 +265,12 @@
- echo "*** Setting up the web interface ***"
-
- # See if web server user exists, if so add to the group.
-- # check for www-data (Debian, etc)
-- grep -q "^www-data:" /etc/passwd
-- if [ $? == 0 ] ; then
-- echo "NOTE: Adding user www-data to group {$PROJECTGROUP}"
-- # this is smart enough to not add multiple times so it's ok to repeat
-- usermod -G {$PROJECTGROUP} -a www-data
-- fi
-- # check for apache (RHEL/CentOS, etc)
-- grep -q "^apache:" /etc/passwd
-+ # check for www (FreeBSD)
-+ grep -q "^www:" /etc/passwd
- if [ $? == 0 ] ; then
-- echo "NOTE: Adding user apache to group {$PROJECTGROUP}"
-+ echo "NOTE: Adding user www to group {$PROJECTGROUP}"
- # this is smart enough to not add multiple times so it's ok to repeat
-- usermod -G {$PROJECTGROUP} -a apache
-+ pw groupmod {$PROJECTGROUP} -m www
- fi
+ # Make sure the user and group exist, if not then create
+-
+- # We do this in the port Makefile
+-
+- #echo "*** Creating user and group ***"
++ echo "*** Creating user and group ***"
- fi # end of WEBONLY
+ # check for group
++ if grep -q "^{$PROJECTGROUP}:" /etc/group; then
++ echo "NOTE: group '{$PROJECTGROUP}' already exists, good."
++ else
++ # use addgroup if it exists since it supports --system
++ if [ -f /usr/sbin/addgroup -a ! -L /usr/sbin/addgroup ]; then
++ addgroup --system {$PROJECTGROUP}
++ else
++ groupadd {$PROJECTGROUP}
++ fi
++ if [ "$?" != "0" ] ; then
++ echo "ERROR: Unable to create group '{$PROJECTGROUP}'"
++ exit 1
++ else
++ echo "NOTE: group '{$PROJECTGROUP}' created"
++ fi
++ fi
++
++ # check for user
++ if grep -q "^{$PROJECTUSER}:" /etc/passwd; then
++ echo "NOTE: user '{$PROJECTUSER}' already exists, good."
++ USERSHELL=`grep "^{$PROJECTUSER}:" /etc/passwd |cut -d: -f 7`
++ if [ "$USERSHELL" = "/bin/false" ]; then
++ echo "ERROR: {$PROJECTUSER} shell must be a real shell"
++ exit 1
++ fi
++ else
++ # ensure that the full parent path of the HOME exists first
++ mkdir -p $\{REPO%/*/*\}
++ # use adduser if it exists since it supports --system, but
++ # not if it's a symlink (probably to /usr/sbin/useradd)
++ if [ -f /usr/sbin/adduser -a ! -L /usr/sbin/adduser ]; then
++ adduser --gecos "{$PROJECT}" --ingroup {$PROJECTGROUP} --system \
++ --shell /bin/bash --home "$\{REPO%/*\}" {$PROJECTUSER}
++ else
++ useradd -c "{$PROJECT}" -g {$PROJECTGROUP} -m \
++ -s /bin/bash -d "$\{REPO%/*\}" {$PROJECTUSER}
++ fi
++ if [ "$?" != "0" ] ; then
++ echo "ERROR: Unable to create user '{$PROJECTUSER}'"
++ exit 1
++ else
++ echo "NOTE: user '{$PROJECTUSER}' created"
++ fi
++ fi
+
+ ## check for existance/ownership/permissions of needed directories
+ echo "*** Making sure needed dirs exist with right ownership/permissions ***"
+@@ -230,5 +280,28 @@
+
+ ########################################################################
+
++if [ $WEBONLY ]; then
++ echo "*** Setting up the web interface ***"
++
++ # See if web server user exists, if so add to the group.
++ # check for www-data (Debian, etc)
++ grep -q "^www-data:" /etc/passwd
++ if [ $? == 0 ] ; then
++ echo "NOTE: Adding user www-data to group {$PROJECTGROUP}"
++ # this is smart enough to not add multiple times so it's ok to repeat
++ usermod -G {$PROJECTGROUP} -a www-data
++ fi
++ # check for apache (RHEL/CentOS, etc)
++ grep -q "^apache:" /etc/passwd
++ if [ $? == 0 ] ; then
++ echo "NOTE: Adding user apache to group {$PROJECTGROUP}"
++ # this is smart enough to not add multiple times so it's ok to repeat
++ usermod -G {$PROJECTGROUP} -a apache
++ fi
++
++fi # end of WEBONLY
++
++########################################################################
++
+ echo "FOSSology postinstall complete, but sure to complete the remaining"
+ echo " steps in the INSTALL instructions."
--- devel-fossology.patch ends here ---
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list