Bug 157593 - [PATCH] Fix port: devel/fossology should use USERS
Summary: [PATCH] Fix port: devel/fossology should use USERS
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Chris Rees
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-04 10:50 UTC by Chris Rees
Modified: 2011-08-09 12:40 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Rees 2011-06-04 10:50:10 UTC
	

	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.

Fix: - Use USERS and GROUPS

	Submitted by: Chris Rees (utisoft@gmail.com)




-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.--mEtPTCMPLyUALxBzBqSZvQrhGs2xAcvZNnCobgUf3YeYDCtc
Content-Type: text/plain; name="devel-fossology.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="devel-fossology.patch"

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."
Comment 1 Edwin Groothuis freebsd_committer 2011-06-04 10:50:21 UTC
Responsible Changed
From-To: freebsd-ports-bugs->pgollucci

pgollucci@ wants his PRs (via the GNATS Auto Assign Tool)
Comment 2 Chris Rees freebsd_committer 2011-06-22 17:53:34 UTC
Responsible Changed
From-To: pgollucci->crees

Invalid autoassignment
Comment 3 Chris Rees freebsd_committer 2011-06-22 18:02:06 UTC
Responsible Changed
From-To: crees->freebsd-ports-bugs

To pool to correct assign message
Comment 4 Chris Rees freebsd_committer 2011-06-22 18:24:41 UTC
Responsible Changed
From-To: freebsd-ports-bugs->crees

Invalid autoassignment to pgollucci
Comment 5 Chris Rees freebsd_committer 2011-07-05 22:18:42 UTC
State Changed
From-To: open->feedback

Sent to ports@ for volunteers
Comment 6 dfilter service freebsd_committer 2011-07-09 10:47:47 UTC
crees       2011-07-09 09:47:33 UTC

  FreeBSD ports repository

  Modified files:
    devel/fossology      Makefile 
    devel/fossology/files patch-common__fo-postinstall.in 
  Log:
  - Use USERS and GROUPS
  - Deprecate -- broken and no volunteers on ports@ after two reminders
  
  PR:             ports/157593
  Submitted by:   crees
  Approved by:    rene (mentor, implicit)
  
  Revision  Changes    Path
  1.8       +5 -0      ports/devel/fossology/Makefile
  1.2       +104 -88   ports/devel/fossology/files/patch-common__fo-postinstall.in
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 7 Chris Rees freebsd_committer 2011-07-09 10:48:46 UTC
State Changed
From-To: feedback->patched

Marked for deprecation on 9/Aug
Comment 8 dfilter service freebsd_committer 2011-08-09 12:30:20 UTC
crees       2011-08-09 11:30:05 UTC

  FreeBSD ports repository

  Modified files:
    .                    MOVED 
    devel                Makefile 
  Removed files:
    devel/fossology      Makefile distinfo pkg-descr pkg-plist 
    devel/fossology/files fossology.in patch-common__Makefile 
                          patch-common__fo-postinstall.in 
                          patch-db__Makefile patch-db__dbcreate.in 
                          patch-scheduler__lockfs.c 
                          patch-scheduler__mkschedconf.c 
                          patch-scheduler__selftest.c 
                          pkg-message.in 
  Log:
  Remove expired port
  2011-08-09 devel/fossology: Broken for four months with no-one caring
  
  PR:             ports/157593
  
  Revision  Changes    Path
  1.2559    +2 -1      ports/MOVED
  1.4478    +0 -1      ports/devel/Makefile
  1.9       +0 -125    ports/devel/fossology/Makefile (dead)
  1.3       +0 -2      ports/devel/fossology/distinfo (dead)
  1.4       +0 -39     ports/devel/fossology/files/fossology.in (dead)
  1.2       +0 -24     ports/devel/fossology/files/patch-common__Makefile (dead)
  1.3       +0 -116    ports/devel/fossology/files/patch-common__fo-postinstall.in (dead)
  1.2       +0 -17     ports/devel/fossology/files/patch-db__Makefile (dead)
  1.2       +0 -11     ports/devel/fossology/files/patch-db__dbcreate.in (dead)
  1.2       +0 -64     ports/devel/fossology/files/patch-scheduler__lockfs.c (dead)
  1.2       +0 -19     ports/devel/fossology/files/patch-scheduler__mkschedconf.c (dead)
  1.2       +0 -11     ports/devel/fossology/files/patch-scheduler__selftest.c (dead)
  1.2       +0 -58     ports/devel/fossology/files/pkg-message.in (dead)
  1.2       +0 -24     ports/devel/fossology/pkg-descr (dead)
  1.3       +0 -969    ports/devel/fossology/pkg-plist (dead)
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 9 Chris Rees freebsd_committer 2011-08-09 12:30:44 UTC
State Changed
From-To: patched->closed

Port removed.