[MacPorts] #16900: guide: return values for tcl extensions such as existsuser and adduser

MacPorts noreply at macports.org
Mon Oct 20 13:22:13 PDT 2008


#16900: guide: return values for tcl extensions such as existsuser and adduser
----------------------------------+-----------------------------------------
  Reporter:  dweber at macports.org  |       Owner:  markd at macports.org     
      Type:  defect               |      Status:  new                    
  Priority:  Normal               |   Milestone:  Website & Documentation
 Component:  guide                |     Version:  1.6.0                  
Resolution:                       |    Keywords:                         
      Port:                       |  
----------------------------------+-----------------------------------------

Comment(by dweber at macports.org):

 If it's of any interest, I created a small test port to investigate how
 the system manages the postgres user account.  This could be used as a
 template to adapt and extend it for use with any port that requires user
 or group management.  I would love some further explanation of how the tcl
 extensions work and a short note on the general utilities availabe on OSX
 for management of users (eg, command line utilities would be most useful
 as 'see also' items in the guide).

 {{{

 PortSystem 1.0

 name            adduser
 version         0.1
 categories      test
 description     test tcl extensions

 fetch           {}
 checksum        {}
 extract         {}
 use_configure   no
 build           {}
 destroot        {}

 set usr      postgres
 set grp      postgres

 post-destroot {

     # Check if the user and group already exist and replace them?
     set uid [existsuser ${usr}]
     set gid [existsgroup ${grp}]

     ui_msg  "${uid}:${gid}"

     if {!${uid}} {
         ui_msg "Creating user:\t ${usr}"
     } else {
         ui_msg "User ${usr} exists,\t uid=${uid}"
     }

     if {!${gid}} {
         ui_msg "Creating group:\t ${grp}"
     } else {
         ui_msg "Group ${grp} exists,\t gid=${gid}"
     }

 }
 }}}

-- 
Ticket URL: <http://trac.macports.org/ticket/16900#comment:2>
MacPorts <http://www.macports.org/>
Ports system for Mac OS


More information about the macports-tickets mailing list