Better than forked gist here is Alternative method below...
#!/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" cd /var/tmp ### or some working dir with several gig of free space
mkdir $pwd/tmp.crosrec
WORKDIR=$pwd/tmp.crosrec
cd $WORKDIR
curl "https://chromium.googlesource.com/chromiumos/user-recovery-tools/+/master/linux/recovery.sh?format=TEXT" -s --output - | base64 --decode > recovery.sh
./recovery.sh --config "https://dl.google.com/dl/edgedl/chromeos/recovery/cloudready_recovery2.conf"
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 (newest), LTC (newer LongTermSupport Candidate, 3-month update) or LTR (older LongTermSupport Release, every 6 months) 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 -
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).