Update chr.sh

Signed-off-by: elseif <elseif@live.cn>
This commit is contained in:
elseif 2025-08-26 17:22:44 +08:00 committed by GitHub
parent 2babd89f27
commit c40954115b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

9
chr.sh
View file

@ -50,7 +50,14 @@ if [[ "$confirm" =~ ^[Nn]$ ]]; then
fi
echo "FILE: $(basename $IMG_URL)"
wget --no-check-certificate -O /tmp/chr.img.zip "$IMG_URL" || { echo "Download failed!"; exit 1; }
if command -v wget >/dev/null 2>&1; then
wget --no-check-certificate -O /tmp/chr.img.zip "$IMG_URL" || { echo "Download failed!"; exit 1; }
elif command -v curl >/dev/null 2>&1; then
curl -L --insecure -o /tmp/chr.img.zip "$IMG_URL" || { echo "Download failed!"; exit 1; }
else
echo "Neither wget nor curl is installed. Cannot download $url"
exit 1
fi
cd /tmp
unzip -p chr.img.zip > chr.img
if LOOP=$(losetup -Pf --show chr.img 2>/dev/null); then