-
-
Save sj-dan/e103425b4b3c3125b393831c3b4c0748 to your computer and use it in GitHub Desktop.
#!/bin/bash | |
URLs=$(curl "https://dl.google.com/dl/edgedl/chromeos/recovery/cloudready_recovery2.json" \ | |
-s --output - | \ | |
grep "^.*\"url\".*$" | \ | |
sed "s/.*\"url\": \"\(.*\)\".*$/\1/g") | |
printf "\nPick which channel to download your image from. Channel name is near the end of the URL.\n\n" | |
select URL in $URLs; | |
do | |
if [[ $URL != "" ]]; then | |
printf "\nDownloading now...\n\n" | |
curl -L -C - -O $URL && break | |
else | |
printf "\nInvalid selection, please pick one of the above displayed numbers.\n\n" | |
fi | |
done | |
printf "\nFinished downloading!\n" |
As an alternative to shell script, you can download flex recovery images in your browser using this non-google site https://chromeos.exerra.xyz/ It also lets you choose any of these 3: stable, LTC (newer) or LTR (older) and shows you for each of the 3, the size, current versions of the recovery image. chrome version, hashes, etc. When I tested it seemed legit and safe as it actually did downloads directly from Google site https://dl.google.com with same download URL as the script got (below): for example https://dl.google.com/dl/edgedl/chromeos/recovery/chromeos_15662.115.0_reven_recovery_lts-channel_mp-v3.bin.zip
If you want to try the recovery.sh script instead, note that when I tested today, 2024-08-08, the downloads part of the script failed on a Chromebook in dev mode until I added -k option to curl and then I see this:
chronos@reven /mnt/stateful_partition/junk $ bash /usr/local/bin/recovery.sh --config "https://dl.google.com/dl/edgedl/chromeos/recovery/cloudready_recovery2.conf"
Working in /tmp/tmp.crosrec/
Downloading config file from https://dl.google.com/dl/edgedl/chromeos/recovery/cloudready_recovery2.conf
If you know the Model string displayed at the recovery screen,
type some or all of it; otherwise just press Enter:
This may take a few minutes to print the full list...
There are 3 recovery images to choose from:
0 - <quit>
1 - ChromeOS Flex
channel: LTC
2 - ChromeOS Flex
channel: LTR
3 - ChromeOS Flex
channel: STABLE
Please select a recovery image to download: 2
...
Unpacking the zipfile
Archive: chromeos_15662.115.0_reven_recovery_lts-channel_mp-v3.bin.zip
skipping: chromeos_15662.115.0_reven_recovery_lts-channel_mp-v3.bin need PK compat. v4.5 (can do v2.1)
The /tmp tmpfs partition on my flex laptop is only 1.9 gig, so it is a good thing the unzip fails because crew installed an ancient 2009 version 6 of unzip. However if you do crew install p7zip
you can uncompress the zip file with 7z x chromeos*.zip
(after moving to a partition with at least 8-9 gig free space, and able to hold a 9 gig file, (not a fat32 USB, tho maybe ExFAT might work).
There is an alternative script that seems to download *bin.zip files ok for me. I used the chromiumos recovery.sh script at https://chromium.googlesource.com/chromiumos/user-recovery-tools/+/master/linux/recovery.sh And it can download the current newest DEV and/or STABLE chromeos-flex *bin.zip files with command-line argument
--config URL
where URL is https://dl.google.com/dl/edgedl/chromeos/recovery/cloudready_recovery2.conf as shown below. That is:NOTE: To allow resuming partial downloads, it uses
/tmp/tmp.crosrec
by default as $WORKDIR. As a bonus, after the download it then optionally offers to write to a USB drive of your choice. I did not test the writing of usb yet, only the ability to download.It is quite a nice little /bin/sh script: simple, but thorough and careful. It is designed to run on mac or linux. It does lots of sanity tests and error checking including checks of zipfilesize, unzipped filesize, checksum of zip file, and if there is enough room on usb flash drive to write the image. It uses dd to write the image to usb flash drive as fast as it can, with bs=4194304 (=1024*4096). Comments suggest in most cases sudo is not needed if you already have permissions for external drives.
Example transcript...
Note that tho I have very slow (2MBs/down) DSL internet, maybe google throttles downloads to even slower speeds??? More likely just my horrible speed of my declining century-link (aka brightspeed) ISP...
Here's the contents of short 2-entry
cloudready_recovery2.conf
file...Note the
zipfilesize=1206930016
matches the actual size of downloaded zip file. The recovery.sh script does warn if any of these are wrong: zipfilesize, filesize after unzip, checksum (md5 or sha1) of the zip file.Running ./recovery.sh with no command-line arguments presents a menu of over 400 chromebook *bin.zip files to download...