sdushantha/snaprecovery

if there is only one device connected via adb, don't ask for a serial ?

Closed this issue · 3 comments

If adb device return only one device, we can assume it's the good one and use its serial ?
I think it's pretty convenient to be able to just run the script as is without having to do extra steps (simple and fast, I agree) to get the device serial every time.
I would be glad to do a pull request to add that feature, I just wanted to know your opinion about it ?

I have a version with awk, tell me if that's a problem I can switch to sed it will just to take more space

Hey @mirsella,

Thanks for bringing this up. It's been a while since I wrote this script, but I do remember thinking of automatically fetching the serial and then fetching the snaps. I think the reason why I did not implement that feature was because of some issues with ADB and the Android device not being authorized as shown in the screenshot below:

image

But I'm not 100% sure that's was the reason why I did not implement that feature though.

Feel free to create a PR and I'll test it out. If it does not create any issue I'll go ahead and merge it 👍

I have a version with awk, tell me if that's a problem I can switch to sed it will just to take more space

awk should be fine

Instead of using adb without -s, I thought of setting the SERIAL variable to the serial of the only connected device if only one is connected, so this problem shouldn't apply.
I'll create a pull request soon.
Thanks !