You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# CHECK IF SOURCES.CONF IS STILL DEFAULT (INDICATING THAT USER IS FIRST TIME CONTRIBUTOR)
3937
+
set confpath "${macports::prefix}/etc/macports/sources.conf"
3938
+
if {[catch {exec [macports::findBinary diff] "-q"$confpath"$confpath.default"} _]} {
3939
+
set tempfd [open"${macports::portdbpath}/contrib" w]
3940
+
close$tempfd
3941
+
return 0
3942
+
}
3943
+
3944
+
# OFFER GIT-BASED SOURCE AND ASK FOR PATH
3945
+
set retvalue [$macports::ui_options(questions_yesno)"You do not seem have a working copy of the macports-ports git repository, which is required to contribute this change.""clone" {} {y} 0 "Create one now?"]
3946
+
if {$retvalue == 1} {
3947
+
# quit as user answered 'no'
3948
+
set tempfd [open"${macports::portdbpath}/contrib" w]
3949
+
close$tempfd
3950
+
return 0
3951
+
}
3952
+
3953
+
set path [$macports::ui_options(questions_input)"Where do you want to create your working copy?" [file join ~ macports-ports] 0]
3954
+
3955
+
# SWITCH TO SUDO_USER UID AND GID
3956
+
set oldeuid [geteuid]
3957
+
set oldgid [getgid]
3958
+
if {[info exists macports::sudo_user]} {
3959
+
set username ${macports::sudo_user}
3960
+
} else {
3961
+
set username [exec id -un]
3962
+
}
3963
+
set useruid [name_to_uid $username]
3964
+
set usergid [uname_to_gid $username]
3965
+
if {$oldeuid == 0} {
3966
+
setegid $usergid
3967
+
seteuid $useruid
3968
+
}
3969
+
3970
+
# Make sure that folder is empty
3971
+
set temp [file normalize $path]
3972
+
if {[file exists $temp]} {
3973
+
set len 0
3974
+
fs-traverse _ $temp {
3975
+
if {$len == 1} {
3976
+
return -code error "path: $temp already exists and is not an empty directory."
3977
+
}
3978
+
incr len
3979
+
}
3980
+
}
3981
+
3982
+
# WALK DOWN FROM PATH TO ROOT AND ASK FOR GROUP X PERMISSIONS IF NEEDED
3983
+
set paths {}
3984
+
while {$temp ne [file normalize /]} {
3985
+
if {![file exists $temp]} {
3986
+
file mkdir $temp
3987
+
}
3988
+
if {[expr {[string index [file attributes $path -permissions] end] & 1}] == 0} {
3989
+
lappend paths $temp
3990
+
}
3991
+
set temp [file dirname $temp]
3992
+
}
3993
+
3994
+
if {[llength$paths] > 0} {
3995
+
set allow [$macports::ui_options(questions_yesno)"The 'macports' user needs search access to $path to use ports in
3996
+
this directory. The following directories will be changed to include 'x'
3997
+
permissions for group and others:\n""allow"$paths {y} 0 "Do you want to allow this?"]
3998
+
if {$allow == 1} {
3999
+
# quit as user answered 'no'
4000
+
set tempfd [open"${macports::portdbpath}/contrib" w]
0 commit comments