Changeset 78660 for trunk/base/src


Ignore:
Timestamp:
May 16, 2011, 2:57:34 PM (9 years ago)
Author:
jmr@…
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)

Location:
trunk/base/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/package1.0/portunarchive.tcl

    r78182 r78660  
    123123    }
    124124
     125    # create any users and groups needed by the port
     126    handle_add_users
     127
    125128    ui_msg "$UI_PREFIX [format [msgcat::mc "Unpacking ${unarchive.type} archive for %s %s_%s%s"] $subport $version $revision $portvariants]"
    126129
  • trunk/base/src/port1.0/portextract.tcl

    r78062 r78660  
    7979    ui_notice "$UI_PREFIX [format [msgcat::mc "Extracting %s"] [option subport]]"
    8080
     81    # create any users and groups needed by the port
     82    handle_add_users
     83
    8184    # should the distfiles be extracted to worksrcpath instead?
    8285    if {[tbool extract.mkdir]} {
  • trunk/base/src/port1.0/portinstall.tcl

    r78396 r78660  
    7171        set registry_open yes
    7272    }
     73
     74    # create any users and groups needed by the port
     75    handle_add_users
    7376}
    7477
  • trunk/base/src/port1.0/portmain.tcl

    r78658 r78660  
    5454        supported_archs depends_skip_archcheck \
    5555        copy_log_files \
    56         compiler.cpath compiler.library_path
     56        compiler.cpath compiler.library_path \
     57        add_users
    5758
    5859# Order of option_proc and option_export matters. Filter before exporting.
     
    104105default supported_archs {}
    105106default depends_skip_archcheck {}
     107default add_users {}
    106108
    107109# Configure settings
  • trunk/base/src/port1.0/portutil.tcl

    r78177 r78660  
    20442044}
    20452045
     2046# create all users/groups listed in the add_users option
     2047# format: [username [option=value ...] ...]
     2048proc handle_add_users {} {
     2049    set cur ""
     2050    foreach val [option add_users] {
     2051        if {[string match *=* $val] && $cur != ""} {
     2052            set split_arg [split $val =]
     2053            if {[lindex $split_arg 0] == "group"} {
     2054                set groupname [lindex $split_arg 1]
     2055                addgroup $groupname
     2056                lappend args($cur) gid=[existsgroup $groupname]
     2057            } else {
     2058                lappend args($cur) $val
     2059            }
     2060        } else {
     2061            set cur $val
     2062        }
     2063    }
     2064    foreach username [array names args] {
     2065        eval adduser $username $args($username)
     2066    }
     2067}
     2068
    20462069proc adduser {name args} {
    20472070    global os.platform
Note: See TracChangeset for help on using the changeset viewer.