Changeset 37888


Ignore:
Timestamp:
Jun 27, 2008, 10:33:57 PM (12 years ago)
Author:
pmagrath@…
Message:

Move macportsuser variable (user to drop privileges to during fetch, configure, build, etc) to macports.conf. Allow setting of macportsuser variable with configure switch --with-macports-user=USER.

Location:
branches/gsoc08-privileges/base
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/gsoc08-privileges/base/aclocal.m4

    r37844 r37888  
    328328        fi
    329329
     330])
     331
     332# MP_CHECK_RUNUSER
     333#-------------------------------------------------
     334AC_DEFUN([MP_CHECK_RUNUSER],[
     335        dnl if with user specifies --with-macports-user,
     336        dnl use it. otherwise default to platform defaults
     337       AC_REQUIRE([MP_PATH_MPCONFIGDIR])
     338
     339        AC_ARG_WITH(install-user, [AC_HELP_STRING([--with-macports-user=USER], [Specify user to drop privileges to, if possible, during compiles,etc.])], [ RUNUSR=$withval ] )
     340       
     341        AC_MSG_CHECKING([for macports user])
     342        if test "x$RUNUSR" = "x" ; then
     343           RUNUSR=`id -un`
     344        fi
     345
     346        AC_MSG_RESULT([$RUNUSR])
     347        AC_SUBST(RUNUSR)
    330348])
    331349
  • branches/gsoc08-privileges/base/configure

    r37844 r37888  
    730730DSTGRP
    731731TCL_PACKAGE_DIR
     732RUNUSR
    732733DSTMODE
    733734MPAPPLICATIONSDIR
     
    14041405  --with-install-group=GROUP
    14051406                          Specify group ownership of installed files
     1407  --with-macports-user=USER
     1408                          Specify user to drop privileges to, if possible,
     1409                          during compiles,etc.
    14061410  --with-directory-mode=MODE
    14071411                          Specify directory mode of installed directories
     
    68396843        { echo "$as_me:$LINENO: result: $DSTGRP" >&5
    68406844echo "${ECHO_T}$DSTGRP" >&6; }
     6845
     6846
     6847
     6848
     6849
     6850
     6851# Check whether --with-install-user was given.
     6852if test "${with_install_user+set}" = set; then
     6853  withval=$with_install_user;  RUNUSR=$withval
     6854fi
     6855
     6856
     6857        { echo "$as_me:$LINENO: checking for macports user" >&5
     6858echo $ECHO_N "checking for macports user... $ECHO_C" >&6; }
     6859        if test "x$RUNUSR" = "x" ; then
     6860           RUNUSR=`id -un`
     6861        fi
     6862
     6863        { echo "$as_me:$LINENO: result: $RUNUSR" >&5
     6864echo "${ECHO_T}$RUNUSR" >&6; }
    68416865
    68426866
     
    1324213266DSTGRP!$DSTGRP$ac_delim
    1324313267TCL_PACKAGE_DIR!$TCL_PACKAGE_DIR$ac_delim
     13268RUNUSR!$RUNUSR$ac_delim
    1324413269DSTMODE!$DSTMODE$ac_delim
    1324513270MPAPPLICATIONSDIR!$MPAPPLICATIONSDIR$ac_delim
     
    1329413319_ACEOF
    1329513320
    13296   if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 66; then
     13321  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 67; then
    1329713322    break
    1329813323  elif $ac_last_try; then
  • branches/gsoc08-privileges/base/configure.ac

    r37844 r37888  
    141141MP_CHECK_INSTALLUSER
    142142MP_CHECK_INSTALLGROUP
     143MP_CHECK_RUNUSER
    143144MP_DIRECTORY_MODE
    144145MP_SHARED_DIRECTORY
  • branches/gsoc08-privileges/base/doc/macports.conf.in

    r36801 r37888  
    44# Set the directory in which to install ports
    55prefix                  @prefix_expanded@
     6
     7# Set the user to run MacPorts compiles, etc as when privileges are dropped during an install
     8macportsuser    @RUNUSR@
    69
    710# Where to store MacPorts working data
  • branches/gsoc08-privileges/base/src/port1.0/portmain.tcl

    r36764 r37888  
    4242
    4343# define options
    44 options prefix name version revision epoch categories maintainers
     44options prefix macportsuser name version revision epoch categories maintainers
    4545options long_description description homepage
    4646options worksrcdir filesdir distname portdbpath libpath distpath sources_conf os.platform os.version os.major os.arch os.endian platforms default_variants install.user install.group macosx_deployment_target
     
    5959default worksymlink {[file join $portpath work]}
    6060default prefix /opt/local
     61default macportsuser {[uid_to_name [getuid]]}
    6162default x11prefix /usr/X11R6
    6263default applications_dir /Applications/MacPorts
  • branches/gsoc08-privileges/base/src/port1.0/portutil.tcl

    r37805 r37888  
    13801380proc open_statefile {args} {
    13811381    global workpath worksymlink place_worksymlink portname portpath ports_ignore_older
    1382     global altprefix macportsuser euid egid usealtworkpath env
     1382    global altprefix macportsuser euid egid usealtworkpath env applications_dir
    13831383   
    13841384        # start gsoc08-privileges
    1385        
    1386         # TODO: move the macportsuser setting to macports.conf
    1387         set macportsuser "[uid_to_name [getuid]]"
    13881385
    13891386        # descalate privileges - only ran if macports stated with sudo
     
    14141411        }
    14151412   
    1416     # if unable to write to workpath, implies running without root privileges so use ~/.macports
     1413    # if unable to write to workpath, implies running without root privileges
     1414    # or a shared directory owned by the group so use ~/.macports
    14171415    if { ![file writable $workpath] } {
    1418        
    1419         if { [getuid] !=0 } {
     1416   
     1417        set userid [getuid]
     1418        set username [uid_to_name $userid]
     1419
     1420        if { $userid !=0 } {
    14201421                ui_msg "Insufficient privileges to perform action for all users."
    1421                 ui_msg "Action will be performed for current user only."
     1422                ui_msg "Action will be performed for current user (${username}) only."
    14221423                ui_msg "Install actions should be executed using sudo."
    14231424                }
     
    14321433                } else {
    14331434                        # the environment var isn't set, make an educated guess
    1434                         set userhome "/Users/[uid_to_name [getuid]]"
     1435                        set userhome "/Users/${username}"
    14351436                }
    14361437               
Note: See TracChangeset for help on using the changeset viewer.