-
Notifications
You must be signed in to change notification settings - Fork 91
Description
I came across an issue on the forums: (from here: https://forum.clockworkpi.com/t/please-help-i-may-have-bricked-my-lte-modem/14987/6 )
They seemed pretty uncertain about whether or not the script did what it was supposed to (they mentioned first that they were certain it was correct, their words:
All was going well and everything was happening exactly like expected in the instructions. I was at the point of running ./flash.sh and even that output looked pretty much exactly like on the screen, right down to finishing up with...
finished. total time: 3.558s
rebooting...
And they went on to explain after rebooting the device that the modem was no longer detected and it just sorta reminded me of the way fastboot works.. becuase it is fastboot however I've never had one go bad on me that I can think of at all actually but it seems apparent that whatever went wrong, happened as a result of them running flash.sh so I decided to look there and see how this script works, and I noticed two things off the bat:
- Missing interpreter shebang (eg:
#!/usr/bin/env bashwithout this it could literally default to virtually any shell which I don't see as behing much of a problem here given that there's no control statements or variable expansion being done but in terms of what is supported that should probably be definitive otherwise this defaults to/bin/sh. YMMV is what I'm getting at and you probably shouldn't rely on/usr/bin/enveither but I feel llke that's better than nothing. - script should (probably) be
set -ebecause there are a list of commands any one of which could fail and by default the script will continue trying to run the remaining commands in the script; this probably shouldn't be the case if you're trying to determine what specifically is failing for users when they're running it. It seems like in any case, the failure mode should be to stop running commands early if one command fails rather than continue all the way tosudo fastboot/bin/fastboot rebootwhich if it's even remotely recoverable before that will almost certainly assure that it won't be based on what people are apparently experiencing with it..