[78660] trunk/base/src
jmr at macports.org
jmr at macports.org
Mon May 16 07:57:35 PDT 2011
Revision: 78660
http://trac.macports.org/changeset/78660
Author: jmr at macports.org
Date: 2011-05-16 07:57:34 -0700 (Mon, 16 May 2011)
Log Message:
-----------
add a new option 'add_users' which is processed before the extract, install, and unarchive phases, so required users and groups will exist when needed whether installing from source or a binary (#11563)
Modified Paths:
--------------
trunk/base/src/package1.0/portunarchive.tcl
trunk/base/src/port1.0/portextract.tcl
trunk/base/src/port1.0/portinstall.tcl
trunk/base/src/port1.0/portmain.tcl
trunk/base/src/port1.0/portutil.tcl
Modified: trunk/base/src/package1.0/portunarchive.tcl
===================================================================
--- trunk/base/src/package1.0/portunarchive.tcl 2011-05-16 13:30:23 UTC (rev 78659)
+++ trunk/base/src/package1.0/portunarchive.tcl 2011-05-16 14:57:34 UTC (rev 78660)
@@ -122,6 +122,9 @@
elevateToRoot "unarchive"
}
+ # create any users and groups needed by the port
+ handle_add_users
+
ui_msg "$UI_PREFIX [format [msgcat::mc "Unpacking ${unarchive.type} archive for %s %s_%s%s"] $subport $version $revision $portvariants]"
return 0
Modified: trunk/base/src/port1.0/portextract.tcl
===================================================================
--- trunk/base/src/port1.0/portextract.tcl 2011-05-16 13:30:23 UTC (rev 78659)
+++ trunk/base/src/port1.0/portextract.tcl 2011-05-16 14:57:34 UTC (rev 78660)
@@ -78,6 +78,9 @@
ui_notice "$UI_PREFIX [format [msgcat::mc "Extracting %s"] [option subport]]"
+ # create any users and groups needed by the port
+ handle_add_users
+
# should the distfiles be extracted to worksrcpath instead?
if {[tbool extract.mkdir]} {
global worksrcpath
Modified: trunk/base/src/port1.0/portinstall.tcl
===================================================================
--- trunk/base/src/port1.0/portinstall.tcl 2011-05-16 13:30:23 UTC (rev 78659)
+++ trunk/base/src/port1.0/portinstall.tcl 2011-05-16 14:57:34 UTC (rev 78660)
@@ -70,6 +70,9 @@
registry::open [file join ${registry.path} registry registry.db]
set registry_open yes
}
+
+ # create any users and groups needed by the port
+ handle_add_users
}
# fake some info for a list of files to match the format
Modified: trunk/base/src/port1.0/portmain.tcl
===================================================================
--- trunk/base/src/port1.0/portmain.tcl 2011-05-16 13:30:23 UTC (rev 78659)
+++ trunk/base/src/port1.0/portmain.tcl 2011-05-16 14:57:34 UTC (rev 78660)
@@ -53,7 +53,8 @@
macosx_deployment_target universal_variant os.universal_supported \
supported_archs depends_skip_archcheck \
copy_log_files \
- compiler.cpath compiler.library_path
+ compiler.cpath compiler.library_path \
+ add_users
# Order of option_proc and option_export matters. Filter before exporting.
@@ -103,6 +104,7 @@
# empty list means all archs are supported
default supported_archs {}
default depends_skip_archcheck {}
+default add_users {}
# Configure settings
default install.user {${portutil::autoconf::install_user}}
Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl 2011-05-16 13:30:23 UTC (rev 78659)
+++ trunk/base/src/port1.0/portutil.tcl 2011-05-16 14:57:34 UTC (rev 78660)
@@ -2043,6 +2043,29 @@
}
}
+# create all users/groups listed in the add_users option
+# format: [username [option=value ...] ...]
+proc handle_add_users {} {
+ set cur ""
+ foreach val [option add_users] {
+ if {[string match *=* $val] && $cur != ""} {
+ set split_arg [split $val =]
+ if {[lindex $split_arg 0] == "group"} {
+ set groupname [lindex $split_arg 1]
+ addgroup $groupname
+ lappend args($cur) gid=[existsgroup $groupname]
+ } else {
+ lappend args($cur) $val
+ }
+ } else {
+ set cur $val
+ }
+ }
+ foreach username [array names args] {
+ eval adduser $username $args($username)
+ }
+}
+
proc adduser {name args} {
global os.platform
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110516/a152b734/attachment.html>
More information about the macports-changes
mailing list