[25586] trunk/base
source_changes at macosforge.org
source_changes at macosforge.org
Fri May 25 01:10:02 PDT 2007
Revision: 25586
http://trac.macosforge.org/projects/macports/changeset/25586
Author: eridius at macports.org
Date: 2007-05-25 01:10:01 -0700 (Fri, 25 May 2007)
Log Message:
-----------
Use dscl instead of niutil (Fixes #11012)
Add support for realname key on addgroup
Modified Paths:
--------------
trunk/base/ChangeLog
trunk/base/doc/portfile.7
trunk/base/src/port1.0/portutil.tcl
Modified: trunk/base/ChangeLog
===================================================================
--- trunk/base/ChangeLog 2007-05-25 07:31:36 UTC (rev 25585)
+++ trunk/base/ChangeLog 2007-05-25 08:10:01 UTC (rev 25586)
@@ -6,6 +6,9 @@
(unreleased)
+ - Update adduser/addgroup to use dscl instead of niutil. Also add support
+ for realname key in addgroup (ticket #11012, eridius r25586).
+
- Make a correction to port(1)'s determination of whether or not a port has
been updated by making it compare ${version} and then ${revision} rather
than a single comparison of the compound ${version}_${revision}; the
Modified: trunk/base/doc/portfile.7
===================================================================
--- trunk/base/doc/portfile.7 2007-05-25 07:31:36 UTC (rev 25585)
+++ trunk/base/doc/portfile.7 2007-05-25 08:10:01 UTC (rev 25586)
@@ -1574,10 +1574,11 @@
.Ar group
.Op Cm gid Ns = Ns gid
.Op Cm passwd Ns = Ns passwd
+.Op Cm realname Ns = Ns realname
.Op Cm users Ns = Ns users
.Xc
-Add a new local group to the system, with the specified gid, password
-and with a list users as members.
+Add a new local group to the system, with the specified gid, password,
+real name, and with a list users as members.
.It Ic existsgroup Ar group
Check if a local group exists and return the corresponding gid. This can be used
with adduser:
Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl 2007-05-25 07:31:36 UTC (rev 25585)
+++ trunk/base/src/port1.0/portutil.tcl 2007-05-25 08:10:01 UTC (rev 25586)
@@ -1646,7 +1646,7 @@
proc adduser {name args} {
global os.platform
- set passwd {\*}
+ set passwd {*}
set uid [nextuid]
set gid [existsgroup nogroup]
set realname ${name}
@@ -1654,59 +1654,59 @@
set shell /dev/null
foreach arg $args {
- if {[regexp {([a-z]*)=(.*)} $arg match key val]} {
- regsub -all " " ${val} "\\ " val
- set $key $val
- }
+ if {[regexp {([a-z]*)=(.*)} $arg match key val]} {
+ regsub -all " " ${val} "\\ " val
+ set $key $val
+ }
}
if {[existsuser ${name}] != 0 || [existsuser ${uid}] != 0} {
- return
+ return
}
- if {${os.platform} == "darwin"} {
- system "niutil -create . /users/${name}"
- system "niutil -createprop . /users/${name} name ${name}"
- system "niutil -createprop . /users/${name} passwd ${passwd}"
- system "niutil -createprop . /users/${name} uid ${uid}"
- system "niutil -createprop . /users/${name} gid ${gid}"
- system "niutil -createprop . /users/${name} realname ${realname}"
- system "niutil -createprop . /users/${name} home ${home}"
- system "niutil -createprop . /users/${name} shell ${shell}"
+ if {${os.platform} eq "darwin"} {
+ exec dscl . -create /Users/${name} Password ${passwd}
+ exec dscl . -create /Users/${name} UniqueID ${uid}
+ exec dscl . -create /Users/${name} PrimaryGroupID ${gid}
+ exec dscl . -create /Users/${name} RealName ${realname}
+ exec dscl . -create /Users/${name} NFSHomeDirectory ${home}
+ exec dscl . -create /Users/${name} UserShell ${shell}
} else {
- # XXX adduser is only available for darwin, add more support here
- ui_warn "WARNING: adduser is not implemented on ${os.platform}."
- ui_warn "The requested user was not created."
+ # XXX adduser is only available for darwin, add more support here
+ ui_warn "WARNING: adduser is not implemented on ${os.platform}."
+ ui_warn "The requested user was not created."
}
}
proc addgroup {name args} {
global os.platform
set gid [nextgid]
- set passwd {\*}
+ set realname ${name}
+ set passwd {*}
set users ""
foreach arg $args {
- if {[regexp {([a-z]*)=(.*)} $arg match key val]} {
- regsub -all " " ${val} "\\ " val
- set $key $val
- }
+ if {[regexp {([a-z]*)=(.*)} $arg match key val]} {
+ regsub -all " " ${val} "\\ " val
+ set $key $val
+ }
}
if {[existsgroup ${name}] != 0 || [existsgroup ${gid}] != 0} {
- return
+ return
}
- if {${os.platform} == "darwin"} {
- system "niutil -create . /groups/${name}"
- system "niutil -createprop . /groups/${name} name ${name}"
- system "niutil -createprop . /groups/${name} gid ${gid}"
- system "niutil -createprop . /groups/${name} passwd ${passwd}"
- system "niutil -createprop . /groups/${name} users ${users}"
+ if {${os.platform} eq "darwin"} {
+ exec dscl . -create /Groups/${name} Password ${passwd}
+ exec dscl . -create /Groups/${name} RealName ${realname}
+ exec dscl . -create /Groups/${name} PrimaryGroupID ${gid}
+ if {${users} ne ""} {
+ exec dscl . -create /Groups/${name} GroupMembership ${users}
+ }
} else {
- # XXX addgroup is only available for darwin, add more support here
- ui_warn "WARNING: addgroup is not implemented on ${os.platform}."
- ui_warn "The requested group was not created."
+ # XXX addgroup is only available for darwin, add more support here
+ ui_warn "WARNING: addgroup is not implemented on ${os.platform}."
+ ui_warn "The requested group was not created."
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070525/488da6a6/attachment.html
More information about the macports-changes
mailing list