Commit a9de5bb3 authored by Shenghou Ma's avatar Shenghou Ma

cmd/dist, sudo.bash: don't mention sudo.bash if cov or prof is not present

        Fixes #3422.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5967057
parent a84056da
...@@ -19,7 +19,7 @@ char *goos; ...@@ -19,7 +19,7 @@ char *goos;
char *goroot = GOROOT_FINAL; char *goroot = GOROOT_FINAL;
char *goroot_final = GOROOT_FINAL; char *goroot_final = GOROOT_FINAL;
char *workdir; char *workdir;
char *tooldir; char *tooldir;
char *gochar; char *gochar;
char *goversion; char *goversion;
char *slash; // / for unix, \ for windows char *slash; // / for unix, \ for windows
...@@ -1462,7 +1462,7 @@ void ...@@ -1462,7 +1462,7 @@ void
cmdbanner(int argc, char **argv) cmdbanner(int argc, char **argv)
{ {
char *pathsep; char *pathsep;
Buf b, b1, search; Buf b, b1, search, path;
ARGBEGIN{ ARGBEGIN{
case 'v': case 'v':
...@@ -1478,6 +1478,7 @@ cmdbanner(int argc, char **argv) ...@@ -1478,6 +1478,7 @@ cmdbanner(int argc, char **argv)
binit(&b); binit(&b);
binit(&b1); binit(&b1);
binit(&search); binit(&search);
binit(&path);
xprintf("\n"); xprintf("\n");
xprintf("---\n"); xprintf("---\n");
...@@ -1495,9 +1496,10 @@ cmdbanner(int argc, char **argv) ...@@ -1495,9 +1496,10 @@ cmdbanner(int argc, char **argv)
xprintf("*** You need to add %s to your PATH.\n", gobin); xprintf("*** You need to add %s to your PATH.\n", gobin);
if(streq(gohostos, "darwin")) { if(streq(gohostos, "darwin")) {
xprintf("\n" if(isfile(bpathf(&path, "%s/cov", tooldir)))
"On OS X the debuggers must be installed setgid procmod.\n" xprintf("\n"
"Read and run ./sudo.bash to install the debuggers.\n"); "On OS X the debuggers must be installed setgid procmod.\n"
"Read and run ./sudo.bash to install the debuggers.\n");
} }
if(!streq(goroot_final, goroot)) { if(!streq(goroot_final, goroot)) {
...@@ -1509,6 +1511,7 @@ cmdbanner(int argc, char **argv) ...@@ -1509,6 +1511,7 @@ cmdbanner(int argc, char **argv)
bfree(&b); bfree(&b);
bfree(&b1); bfree(&b1);
bfree(&search); bfree(&search);
bfree(&path);
} }
// Version prints the Go version. // Version prints the Go version.
......
...@@ -12,12 +12,17 @@ Darwin) ...@@ -12,12 +12,17 @@ Darwin)
exit 0 exit 0
esac esac
eval $(go env)
if ! [ -x $GOTOOLDIR/cov -a -x $GOTOOLDIR/prof ]; then
echo "You don't need to run sudo.bash." >&2
exit 2
fi
if [[ ! -d /usr/local/bin ]]; then if [[ ! -d /usr/local/bin ]]; then
echo 1>&2 'sudo.bash: problem with /usr/local/bin; cannot install tools.' echo 1>&2 'sudo.bash: problem with /usr/local/bin; cannot install tools.'
exit 2 exit 2
fi fi
eval $(go env)
cd $(dirname $0) cd $(dirname $0)
for i in prof cov for i in prof cov
do do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment