diff --git a/src/install.sh b/src/install.sh index e9c34dd..9827ccb 100644 --- a/src/install.sh +++ b/src/install.sh @@ -127,9 +127,9 @@ printVersion() { [[ "$id" == "win2008"* ]] && desc="Windows Server 2008" [[ "$id" == "win10x64-iot" ]] && desc="Windows 10 IoT" [[ "$id" == "win11x64-iot" ]] && desc="Windows 11 IoT" - [[ "$id" == "win10x64-ltsc" ]] && desc="Windows 10 LTSC" + [[ "$id" == "win10x64-ltsc" ]] && desc="Windows 10 LTSC" [[ "$id" == "win11x64-ltsc" ]] && desc="Windows 11 LTSC" - + echo "$desc" return 0 } @@ -456,7 +456,7 @@ downloadImage() { if (( rc == 0 )); then - [ ! -s "$iso" ] && return 1 + [ ! -s "$iso" ] || [ ! -f "$iso" ] && return 1 html "Download finished successfully..." return 0 @@ -499,7 +499,7 @@ downloadImage() { fKill "progress.sh" (( rc != 0 )) && error "Failed to download $url , reason: $rc" && exit 60 - [ ! -s "$iso" ] && return 1 + [ ! -s "$iso" ] || [ ! -f "$iso" ] && return 1 html "Download finished successfully..." return 0 @@ -654,7 +654,7 @@ detectImage() { if [ -n "$DETECTED" ]; then - if [ -s "/run/assets/$DETECTED.xml" ]; then + if [ -f "/run/assets/$DETECTED.xml" ]; then [[ "$MANUAL" != [Yy1]* ]] && XML="$DETECTED.xml" return 0 fi @@ -673,7 +673,7 @@ detectImage() { info "Detecting Windows version from ISO image..." - if [ -s "$dir/WIN51" ] || [ -s "$dir/SETUPXP.HTM" ]; then + if [ -f "$dir/WIN51" ] || [ -f "$dir/SETUPXP.HTM" ]; then DETECTED="winxpx86" info "Detected: Windows XP" return 0 @@ -689,9 +689,9 @@ detectImage() { fi loc=$(find "$src" -maxdepth 1 -type f -iname install.wim | head -n 1) - [ ! -s "$loc" ] && loc=$(find "$src" -maxdepth 1 -type f -iname install.esd | head -n 1) + [ ! -f "$loc" ] && loc=$(find "$src" -maxdepth 1 -type f -iname install.esd | head -n 1) - if [ ! -s "$loc" ]; then + if [ ! -f "$loc" ]; then warn "failed to locate 'install.wim' or 'install.esd' in ISO image, $FB" BOOT_MODE="windows_legacy" return 1 @@ -719,7 +719,7 @@ detectImage() { desc=$(printVersion "$DETECTED") [ -z "$desc" ] && desc="$DETECTED" - if [ -s "/run/assets/$DETECTED.xml" ]; then + if [ -f "/run/assets/$DETECTED.xml" ]; then [[ "$MANUAL" != [Yy1]* ]] && XML="$DETECTED.xml" info "Detected: $desc" else @@ -939,7 +939,7 @@ prepareImage() { if [[ "${DETECTED,,}" != "winxp"* ]] && [[ "${DETECTED,,}" != "win2008"* ]]; then if [[ "${DETECTED,,}" != "winvista"* ]] && [[ "${DETECTED,,}" != "win7"* ]]; then - if [ -s "$dir/$ETFS" ] && [ -s "$dir/$EFISYS" ]; then + if [ -f "$dir/$ETFS" ] && [ -f "$dir/$EFISYS" ]; then return 0 fi @@ -975,7 +975,7 @@ updateImage() { local asset="/run/assets/$3" local path src loc index result - [ ! -s "$asset" ] && return 0 + [ ! -s "$asset" ] || [ ! -f "$asset" ] && return 0 path=$(find "$dir" -maxdepth 1 -type f -iname autounattend.xml | head -n 1) [ -n "$path" ] && cp "$asset" "$path" @@ -989,9 +989,9 @@ updateImage() { fi loc=$(find "$src" -maxdepth 1 -type f -iname boot.wim | head -n 1) - [ ! -s "$loc" ] && loc=$(find "$src" -maxdepth 1 -type f -iname boot.esd | head -n 1) + [ ! -f "$loc" ] && loc=$(find "$src" -maxdepth 1 -type f -iname boot.esd | head -n 1) - if [ ! -s "$loc" ]; then + if [ ! -f "$loc" ]; then warn "failed to locate 'boot.wim' or 'boot.esd' in ISO image, $FB" BOOT_MODE="windows_legacy" return 1 @@ -1100,7 +1100,7 @@ if ! startInstall; then return 0 fi -if [ ! -s "$ISO" ]; then +if [ ! -s "$ISO" ] || [ ! -f "$ISO" ]; then rm -f "$ISO" if ! downloadImage "$ISO" "$VERSION"; then error "Failed to download $VERSION"