ikluft / piflash

Write ("flash") a Raspberry Pi boot image to an SD card, with features for power users (auto-unwrap archive files) or newbies (safety checks to avoid erasing wrong device)
Apache License 2.0
10 stars 1 forks source link

Feature request: Fetch images automatically #3

Open stevieb9 opened 5 years ago

stevieb9 commented 5 years ago

I'm the author of RPi::WiringPi, WiringPi::API amongst others, and am wondering if you'd be interested in hacking into your distribution the ability to grab the "latest" version of the images from the Raspberry Pi download site automatically.

You've named this distribution "Pi" related, so it makes sense to keep it in that scope.

This isn't a 'bug' or an 'issue' per-se, it's a request to understand if the above fits your roadmap or not. If so, could you provide guidance as to how that could/might be built-in?

ikluft commented 5 years ago

That's a good idea. So we'll use this newly-created issue to track it.

Actually, the thought had occurred to me too while typing in the name of a downloaded file. There was obviously a step that can be automated there. The implementation would need a list of known distributions and their URLs. Probably also a local cache directory to avoid downloading the same gigabyte+ file more than once.

stevieb9 commented 5 years ago

By appearances, the "latest" of both Noobs and Rasbpian have direct links that could be fetched by easily, so long as those links don't change.

That said, if you're down with this idea, I could reach out to the Raspberry Pi team to see if they could provide an API or at least a JSON link where versions could be grabbed from.

I'm also the author of berrybrew (Perlbrew for Windows), so we may have a bit of clout getting information about stabilizing the information about releases.

berrybrew is written in C#, but I digress. Let's make this new feature work here, yes?

I often scour the CPAN for new distributions I find interesting, then write patches (PRs) for. This one came up, and thought... this is a very good example of something I'd like to include in the RPi offerings.

stevieb9 commented 5 years ago

Probably also a local cache directory to avoid downloading the same gigabyte+ file more than once.

Done by version number within the actual link (if available), and some form of checksum (which is available on the site itself).

Checksum and version doesn't match? warn/delete.

ikluft commented 5 years ago

That sounds great. Nice to meet you! Lots of good ideas. We may also help the Raspberry Pi Foundation with writing the tool to provide that API, if that helps to convince them. Currently the list of RPi downloads is stuck around what was available in 2013. (New versions available by the links, but no new distributions.) So Fedora and FreeBSD aren't on the list. I made a list at https://metacpan.org/pod/distribution/PiFlash/doc/resources.pod where users can find more. (edit: URL updated after I converted the doc from Markdown to POD so MetaCPAN will display it on the release page)

stevieb9 commented 5 years ago

Let's leave the nice(ities) off of this issue. We'll talk more tomorrow. I think we can combine to get things done. Reach me at my email.

This particular comment will eventually self destruct (due to a debouncing issue on my Pi).

ikluft commented 5 years ago

Making notes how this will have to be done... As I browsed some available downloads observing URL paths we'll need to process, I see we'll also need to allow the user to set which model of Raspberry Pi the download is for. It should default to the latest model, currently the RPi 3/3+ which is an aarch64 architecture.

stevieb9 commented 5 years ago

Reached out directly to a contact at the Raspberry Pi organization regarding access to any API or data for the downloads (or if they exist at all), and also created a forum post for good measure.

Will advise when I get any info back.

stevieb9 commented 5 years ago

Was advised about their archive site, which appears to be what we may be looking for. If you'd like, over the next week, I can develop a parser for the JSON data, and after that's done, perhaps we can discuss how to present the information to the user for selection.

ikluft commented 5 years ago

Interesting. It's a source of data. They're still missing Alpine, Arch, Fedora, FreeBSD, etc - we'll have to maintain our own list of what they're missing. I can parse JSON - but before I start, I should ask if that's something you're itching to contribute.