Update install.sh

This commit is contained in:
Kroese 2024-05-04 15:49:09 +02:00 committed by GitHub
parent 37f400a49b
commit a27db5b13d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -240,12 +240,18 @@ getESD() {
error "Failed to find Windows product in $eFile!" && return 1 error "Failed to find Windows product in $eFile!" && return 1
fi fi
ESD=$(xmllint --nonet --xpath '//FilePath' "$dir/$eFile" | sed -E -e 's/<[\/]?FilePath>//g') local tag="FilePath"
ESD=$(xmllint --nonet --xpath "'//$tag'" "$dir/$eFile" | sed -E -e "'s/<[\/]?$tag>//g'")
if [ -z "$ESD" ]; then if [ -z "$ESD" ]; then
error "Failed to find ESD URL in $eFile!" && return 1 error "Failed to find ESD URL in $eFile!" && return 1
fi fi
tag="Sha1"
ESD_SUM=$(xmllint --nonet --xpath "'//$tag'" "$dir/$eFile" | sed -E -e "'s/<[\/]?$tag>//g'")
tag="Size"
ESD_SIZE=$(xmllint --nonet --xpath "'//$tag'" "$dir/$eFile" | sed -E -e "'s/<[\/]?$tag>//g'")
rm -rf "$dir" rm -rf "$dir"
return 0 return 0
} }
@ -262,7 +268,7 @@ doMido() {
local msg="Downloading $desc..." local msg="Downloading $desc..."
info "$msg" && html "$msg" info "$msg" && html "$msg"
/run/progress.sh "$iso.PART" "Downloading $desc ([P])..." & /run/progress.sh "$iso.PART" "" "Downloading $desc ([P])..." &
cd "$TMP" cd "$TMP"
{ /run/mido.sh "${version,,}"; rc=$?; } || : { /run/mido.sh "${version,,}"; rc=$?; } || :
@ -293,7 +299,11 @@ verifyFile() {
html "Verifying downloaded ISO..." html "Verifying downloaded ISO..."
info "Calculating SHA256 checksum of the ISO file..." info "Calculating SHA256 checksum of the ISO file..."
if [[ "${#check}" == "40" ]]; then
hash=$(shasum "$iso" | cut -f1 -d' ')
else
hash=$(sha256sum "$iso" | cut -f1 -d' ') hash=$(sha256sum "$iso" | cut -f1 -d' ')
fi
if [[ "$hash" == "$check" ]]; then if [[ "$hash" == "$check" ]]; then
info "Succesfully verified that the checksum was correct!" && return 0 info "Succesfully verified that the checksum was correct!" && return 0
@ -310,7 +320,8 @@ downloadFile() {
local iso="$1" local iso="$1"
local url="$2" local url="$2"
local sum="$3" local sum="$3"
local desc="$4" local size="$4"
local desc="$5"
local rc progress domain dots local rc progress domain dots
rm -f "$iso" rm -f "$iso"
@ -333,7 +344,7 @@ downloadFile() {
fi fi
info "$msg" && html "$msg" info "$msg" && html "$msg"
/run/progress.sh "$iso" "Downloading $desc ([P])..." & /run/progress.sh "$iso" "$size" "Downloading $desc ([P])..." &
{ wget "$url" -O "$iso" -q --show-progress "$progress"; rc=$?; } || : { wget "$url" -O "$iso" -q --show-progress "$progress"; rc=$?; } || :
@ -363,7 +374,7 @@ downloadImage() {
if [[ "${version,,}" == "http"* ]]; then if [[ "${version,,}" == "http"* ]]; then
desc=$(fromFile "$BASE") desc=$(fromFile "$BASE")
downloadFile "$iso" "$version" "" "$desc" && return 0 downloadFile "$iso" "$version" "" "" "$desc" && return 0
return 1 return 1
fi fi
@ -390,7 +401,7 @@ downloadImage() {
if getESD "$TMP/esd" "$version"; then if getESD "$TMP/esd" "$version"; then
ISO="$TMP/$version.esd" ISO="$TMP/$version.esd"
downloadFile "$ISO" "$ESD" "" "$desc" && return 0 downloadFile "$ISO" "$ESD" "$ESD_SUM" "$ESD_SIZE" "$desc" && return 0
ISO="$TMP/$BASE" ISO="$TMP/$BASE"
fi fi
@ -406,7 +417,7 @@ downloadImage() {
fi fi
tried="y" tried="y"
sum=$(getHash "$i" "$version") sum=$(getHash "$i" "$version")
downloadFile "$iso" "$url" "$sum" "$desc" && return 0 downloadFile "$iso" "$url" "$sum" "" "$desc" && return 0
fi fi
done done