cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject git commit: CB-2445: detect global installs into root-only locations a bit more robustly. Warn noisily if this is so and provide specific instructions on how to fix.
Date Mon, 18 Feb 2013 22:27:40 GMT
Updated Branches:
  refs/heads/master c8e05a8d8 -> b9d9837e3


CB-2445: detect global installs into root-only locations a bit more robustly. Warn noisily
if this is so and provide specific instructions on how to fix.


Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/b9d9837e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/b9d9837e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/b9d9837e

Branch: refs/heads/master
Commit: b9d9837e36565a6447e5272d406843ee031cae2a
Parents: c8e05a8
Author: Fil Maj <maj.fil@gmail.com>
Authored: Mon Feb 18 14:27:28 2013 -0800
Committer: Fil Maj <maj.fil@gmail.com>
Committed: Mon Feb 18 14:27:28 2013 -0800

----------------------------------------------------------------------
 bootstrap.js |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b9d9837e/bootstrap.js
----------------------------------------------------------------------
diff --git a/bootstrap.js b/bootstrap.js
index 89a032b..7152a6b 100644
--- a/bootstrap.js
+++ b/bootstrap.js
@@ -53,11 +53,16 @@ var platformsDir = path.join(cordovaDir, 'platforms');
 shell.rm('-rf', path.join(cordovaDir, 'www', 'spec'));
 
 var end = n(platforms.length, function() {
-    console.log("************************************************************************");
-    console.log("* Please NOTE: it is highly recommended to run the command:            *");
-    console.log("*     sudo chown -R <yourusername> /usr/local/lib/node_modules/cordova
*");
-    console.log("* This will allow you to run this tool globally without root.          *");
-    console.log("************************************************************************");
+    // Check that we are installing globally into a root-only directory.
+    if (process.env.USER == 'root' && process.env.npm_config_prefix.indexOf('/usr/local')
=== 0) {
+        console.log("**************************************************************************");
+        console.log("* WARNING: YOU ARE INSTALLING GLOBALLY INTO A ROOT-ONLY DIRECTORY!!!1one
*");
+        console.log("* Your node install is global, so global modules get installed there
too.*");
+        console.log("* You should probably run the following command for this tool to run:
   *");
+        console.log("    $ sudo chown -R " + process.env.SUDO_USER + " " + process.env.PWD);
+        console.log("* This will allow you to run this tool globally without using `sudo`.
   *");
+        console.log("**************************************************************************");
+    }
 });
 
 platforms.forEach(function(platform) {


Mime
View raw message