B-AROL-O / ble-testsuite

Automated test suite for Bluetooth Low Energy devices
https://ble-testsuite.netlify.app
MIT License
1 stars 1 forks source link

[BUG]: install.sh should fail gracefully if sudo is not installed #31

Closed gmacario closed 1 year ago

gmacario commented 1 year ago

Description of the bug

The install.sh script fails with a cryptic error if no sudo command is available.

Steps To Reproduce

Execute on a shell where the host has no sudo command installed

  1. Type curl -fsSL https://ble-testsuite.netlify.app/install.sh | sh
  2. Watch the result

Additional Information

Example of error:

gmaca@alpha MINGW64 ~
$ curl -fsSL https://ble-testsuite.netlify.app/install.sh | sh
+ sudo apt-get update
sh: line 6: sudo: command not found
+ which bluetoothctl
which: no bluetoothctl in (/c/Users/gmaca/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/gmaca/bin:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/WINDOWS/System32/OpenSSH:/c/Program Files (x86)/ATI Technologies/ATI.ACE/Core-Static:/c/Program Files/dotnet:/c/ProgramData/chocolatey/bin:/e/opt/arduino-cli:/e/opt/PuTTY:/e/opt/ncs/nrf-command-line-tools/bin:/e/opt/Tailscale:/c/Program Files/Docker/Docker/resources/bin:/e/opt/nodejs:/cmd:/c/Users/gmaca/.console-ninja/.bin:/e/opt/Python/Python311/Scripts:/e/opt/Python/Python311:/c/Users/gmaca/.local/bin:/c/Users/gmaca/AppData/Local/Microsoft/WindowsApps:/c/Users/gmaca/AppData/Local/Programs/Microsoft VS Code/bin:/c/Users/gmaca/AppData/Roaming/nvm:/c/Program Files/nodejs:/e/opt/heroku/bin:/e/opt/github/cli:/c/Users/gmaca/AppData/Local/Microsoft/WindowsApps:/c/Users/gmaca/AppData/Roaming/Code/User/globalStorage/ms-vscode-remote.remote-containers/cli-bin:/c/Users/gmaca/AppData/Roaming/npm:/usr/bin/vendor_perl:/usr/bin/core_perl)
+ sudo apt-get -y install bluez
sh: line 11: sudo: command not found

gmaca@alpha MINGW64 ~
$
Siddharth9890 commented 1 year ago

@gmacario i can try to resolve this

gmacario commented 1 year ago

@gmacario i can try to resolve this

You are welcome @Siddharth9890 !

Siddharth9890 commented 1 year ago
image

@gmacario is this output fine just one thing we need to change this . set +x so that we dont get unncessary debug logs. This will run before any apt install commands

gmacario commented 1 year ago

Fix by @Siddharth9890 via https://github.com/B-AROL-O/ble-testsuite/pull/33