Allow check for root user to process correctly on Solaris.
This commit is contained in:
parent
10cb2e7035
commit
80ff1f29a4
1 changed files with 13 additions and 1 deletions
14
bin/lein
14
bin/lein
|
@ -83,7 +83,19 @@ function self_install {
|
|||
fi
|
||||
}
|
||||
|
||||
if [ "$(id -u)" -eq 0 ] && [ "$LEIN_ROOT" = "" ]; then
|
||||
function check_root {
|
||||
local -i user_id
|
||||
# Thank you for the complexity, Solaris
|
||||
if [ `uname` = "SunOS" -a -x /usr/xpg4/bin/id ]; then
|
||||
user_id=$(/usr/xpg4/bin/id -u 2>/dev/null || echo 0)
|
||||
else
|
||||
user_id=$(id -u 2>/dev/null || echo 0)
|
||||
fi
|
||||
[ $user_id -eq 0 -a "$LEIN_ROOT" = "" ] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
if check_root; then
|
||||
echo "WARNING: You're currently running as root; probably by accident."
|
||||
echo "Press control-C to abort or Enter to continue as root."
|
||||
echo "Set LEIN_ROOT to disable this warning."
|
||||
|
|
Loading…
Reference in a new issue