pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/40737: bad flag in useradd for Linux



The following reply was made to PR pkg/40737; it has been noted by GNATS.

From: Piotr Meyer <aniou%smutek.pl@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: pkg/40737: bad flag in useradd for Linux
Date: Thu, 26 Feb 2009 11:09:49 +0100

 --1yeeQ81UyVL57Vl7
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 On Tue, Feb 24, 2009 at 04:40:04PM +0000, Joerg Sonnenberger wrote:
   
 >  Only if you can provide a way that works on all distributions to inhibit
 >  the creation of the home directory. It was broken before, so this is not
 >  really worse.
 
 Patch in attachment and under following link:
 http://aniou.smutek.pl/useradd-for-linux.diff
 
 -- 
 Piotr 'aniou' Meyer
 
 --1yeeQ81UyVL57Vl7
 Content-Type: text/x-diff; charset=us-ascii
 Content-Disposition: attachment; filename="useradd-for-linux.diff"
 
 --- mk/pkginstall/usergroupfuncs.Linux-orig    2009-02-26 09:34:05.000000000 
+0000
 +++ mk/pkginstall/usergroupfuncs.Linux 2009-02-26 10:06:48.000000000 +0000
 @@ -104,18 +104,26 @@
  
        if ${TEST} -n "${USERADD}" -a -x "${USERADD}"; then
                ${ECHO} "${PKGNAME}: Creating user \`\`$user''"
 +
                case $userid in
 -              "")
 -                      ${USERADD}                                      \
 +              "")     _extraopt="" ;;
 +              *)      _extraopt="-u ${userid}" ;;
 +              esac
 +
 +              _exitcode=0
 +              _exitmsg=$(${USERADD}                                   \
                                -c "$descr" -d "$home" -s "$shell"      \
 -                              -g $group $user -M
 -                      ;;
 -              *)
 +                              -g $group ${_extraopt} -M $user 2>&1 ) || 
_exitcode=$?
 +
 +              # some versions useradd does not support '-M'
 +              if [ ${_exitcode} -eq 2 ]; then
                        ${USERADD}                                      \
                                -c "$descr" -d "$home" -s "$shell"      \
 -                              -g $group -u $userid $user -M
 -                      ;;
 -              esac
 +                              -g $group ${_extraopt} $user
 +              elif [ ${_exitcode} -gt 0 ]; then
 +                      echo ${_exitmsg}
 +                      exit ${_exitcode}
 +              fi
        fi
        return 0
  }
 
 --1yeeQ81UyVL57Vl7--
 


Home | Main Index | Thread Index | Old Index