[csw-devel] SF.net SVN: gar:[6858] csw/mgar/pkg/cswclassutils/trunk/files/ CSWcswclassutils.i.cswusergroup

bdwalton at users.sourceforge.net bdwalton at users.sourceforge.net
Wed Oct 14 04:37:00 CEST 2009


Revision: 6858
          http://gar.svn.sourceforge.net/gar/?rev=6858&view=rev
Author:   bdwalton
Date:     2009-10-14 02:37:00 +0000 (Wed, 14 Oct 2009)

Log Message:
-----------
cswclassutils: add ability to specify that created account is NP instead of *LK*

Modified Paths:
--------------
    csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswusergroup

Modified: csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswusergroup
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswusergroup	2009-10-14 00:19:34 UTC (rev 6857)
+++ csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswusergroup	2009-10-14 02:37:00 UTC (rev 6858)
@@ -34,6 +34,7 @@
     dir=`echo $i | awk -F':' '{print $4}'`
     shell=`echo $i | awk -F':' '{print $5}'`
     create=`echo $i | awk -F':' '{print $6}'`
+    nopass=`echo $i | awk -F':' '{print $8}'`
     if [ -n "$group" ]; then
       /bin/getent group $group > /dev/null
       if [ $? -ne 0 ]; then
@@ -77,6 +78,27 @@
       else
         echo User $user already exists
       fi
+
+      if [ -n "$nopass" ]; then
+	  omask=`umask`
+	  umask 0377
+	  awk 'BEGIN { FS=":"; OFS=":" } $1 == "'$user'" { $2 = "NP" } { print }' /etc/shadow > /etc/shadow.$PKGINST
+	  if [ $? -eq 0 ]; then
+	      cmp -s /etc/shadow /etc/shadow.$PKGINST
+	      if [ $? -ne 0 ]; then
+		  echo "Updating account '$user' to be no-login (NP)"
+		  chgrp sys /etc/shadow.$PKGINST
+		  cp -p /etc/shadow /etc/shadow.CSW && \
+		      mv /etc/shadow.$PKGINST /etc/shadow
+	      else
+		  rm /etc/shadow.$PKGINST
+	      fi
+	  else
+	      echo "ERROR: Setting NP for '$user' failed."
+	      rm /etc/shadow.$PKGINST
+	  fi
+	  umask $omask
+      fi
     else
       echo No user to create
     fi


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list