Skip to content

Instantly share code, notes, and snippets.

@sj-dan
Last active August 8, 2024 06:15
Show Gist options
  • Save sj-dan/e103425b4b3c3125b393831c3b4c0748 to your computer and use it in GitHub Desktop.
Save sj-dan/e103425b4b3c3125b393831c3b4c0748 to your computer and use it in GitHub Desktop.
Script to fetch and download the latest version of the Chrome OS Flex image
#!/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"
@porteusconf
Copy link

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment