Improve error message when 'unshare' is not installed.
Currently if the user has not installed unshare they get the following error
message:
sudo: unshare: command not found
With this CL, they'll get the following message instead.
cros_sdk: error: The tool(s) unshare were not found.
Please install the appropriate package in your host.
Example(ubuntu):
sudo apt-get install <packagename>
BUG=none
TEST=Verify above message is given when unshare is not installed.
Change-Id: I3c9837511f30c71754faa8a0263532e8e2ac0c45
Reviewed-on: https://gerrit.chromium.org/gerrit/41722
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
diff --git a/scripts/cros_sdk.py b/scripts/cros_sdk.py
index ebeda08..e4a2291 100644
--- a/scripts/cros_sdk.py
+++ b/scripts/cros_sdk.py
@@ -271,8 +271,6 @@
# Some sanity checks first, before we ask for sudo credentials.
cros_build_lib.AssertOutsideChroot()
- _ReExecuteIfNeeded([sys.argv[0]] + argv)
-
host = os.uname()[4]
if host != 'x86_64':
parser.error(
@@ -282,12 +280,14 @@
missing = osutils.FindMissingBinaries(NEEDED_TOOLS)
if missing:
parser.error((
- 'The tool(s) %s were not found.'
- 'Please install the appropriate package in your host.'
- 'Example(ubuntu):'
+ 'The tool(s) %s were not found.\n'
+ 'Please install the appropriate package in your host.\n'
+ 'Example(ubuntu):\n'
' sudo apt-get install <packagename>'
% (', '.join(missing))))
+ _ReExecuteIfNeeded([sys.argv[0]] + argv)
+
# Expand out the aliases...
if options.replace:
options.delete = options.create = True