contrib: Check if getent is available in git setup script [PR111359]
contrib/ChangeLog: PR other/111359 * gcc-git-customization.sh: Check for getent before using it. Use id on macOS.
This commit is contained in:
parent
48d4ab6980
commit
5c3c04960d
1 changed files with 5 additions and 1 deletions
|
@ -46,7 +46,11 @@ set_email=$(git config --get "user.email")
|
|||
if [ "x$set_user" = "x" ]
|
||||
then
|
||||
# Try to guess the user's name by looking it up in the password file
|
||||
new_user=$(getent passwd $(whoami) | awk -F: '{ print $5 }')
|
||||
if type getent >/dev/null 2>&1; then
|
||||
new_user=$(getent passwd $(whoami) | awk -F: '{ print $5 }')
|
||||
elif [ $(uname -s) = Darwin ]; then
|
||||
new_user=$(id -F 2>/dev/null)
|
||||
fi
|
||||
if [ "x$new_user" = "x" ]
|
||||
then
|
||||
new_user="(no default)"
|
||||
|
|
Loading…
Add table
Reference in a new issue