@@ -201,7 +201,7 @@ abortInstall() {
201201 [[ " ${iso,,} " == * " .esd" ]] && exit 60
202202 [[ " ${UNPACK:- } " == [Yy1]* ]] && exit 60
203203
204- efi=$( find " $dir " -maxdepth 1 -type d -iname efi | head -n 1 )
204+ efi=$( find " $dir " -maxdepth 1 -type d -iname efi -print -quit )
205205
206206 if [ -z " $efi " ]; then
207207 [[ " ${PLATFORM,,} " == " x64" ]] && BOOT_MODE=" windows_legacy"
@@ -230,17 +230,17 @@ detectCustom() {
230230
231231 CUSTOM=" "
232232
233- dir=$( find / -maxdepth 1 -type d -iname " $fname " | head -n 1 )
234- [ ! -d " $dir " ] && dir=$( find " $STORAGE " -maxdepth 1 -type d -iname " $fname " | head -n 1 )
233+ dir=$( find / -maxdepth 1 -type d -iname " $fname " -print -quit )
234+ [ ! -d " $dir " ] && dir=$( find " $STORAGE " -maxdepth 1 -type d -iname " $fname " -print -quit )
235235
236236 if [ -d " $dir " ]; then
237237 if ! hasDisk || [ ! -f " $boot " ]; then
238238 error " The bind $dir maps to a file that does not exist!" && return 1
239239 fi
240240 fi
241241
242- file=$( find / -maxdepth 1 -type f -iname " $fname " | head -n 1 )
243- [ ! -s " $file " ] && file=$( find " $STORAGE " -maxdepth 1 -type f -iname " $fname " | head -n 1 )
242+ file=$( find / -maxdepth 1 -type f -iname " $fname " -print -quit )
243+ [ ! -s " $file " ] && file=$( find " $STORAGE " -maxdepth 1 -type f -iname " $fname " -print -quit )
244244
245245 if [ ! -s " $file " ] && [[ " ${VERSION,,} " != " http" * ]]; then
246246 base=$( basename " $VERSION " )
@@ -396,7 +396,7 @@ extractImage() {
396396
397397 else
398398
399- file=$( find " $dir " -maxdepth 1 -type f -iname " *.iso" | head -n 1 )
399+ file=$( find " $dir " -maxdepth 1 -type f -iname " *.iso" -print -quit )
400400
401401 if [ -z " $file " ]; then
402402 error " Failed to find any .iso file in archive!" && return 1
@@ -591,14 +591,14 @@ detectImage() {
591591 fi
592592
593593 local src wim info
594- src=$( find " $dir " -maxdepth 1 -type d -iname sources | head -n 1 )
594+ src=$( find " $dir " -maxdepth 1 -type d -iname sources -print -quit )
595595
596596 if [ ! -d " $src " ]; then
597597 warn " failed to locate 'sources' folder in ISO image, $FB " && return 1
598598 fi
599599
600- wim=$( find " $src " -maxdepth 1 -type f -iname install.wim | head -n 1 )
601- [ ! -f " $wim " ] && wim=$( find " $src " -maxdepth 1 -type f -iname install.esd | head -n 1 )
600+ wim=$( find " $src " -maxdepth 1 -type f -iname install.wim -print -quit )
601+ [ ! -f " $wim " ] && wim=$( find " $src " -maxdepth 1 -type f -iname install.esd -print -quit )
602602
603603 if [ ! -f " $wim " ]; then
604604 warn " failed to locate 'install.wim' or 'install.esd' in ISO image, $FB " && return 1
@@ -892,14 +892,14 @@ updateImage() {
892892 rm -rf " $tmp "
893893 mkdir -p " $tmp "
894894
895- src=$( find " $dir " -maxdepth 1 -type d -iname sources | head -n 1 )
895+ src=$( find " $dir " -maxdepth 1 -type d -iname sources -print -quit )
896896
897897 if [ ! -d " $src " ]; then
898898 error " failed to locate 'sources' folder in ISO image, $FB " && return 1
899899 fi
900900
901- wim=$( find " $src " -maxdepth 1 -type f -iname boot.wim | head -n 1 )
902- [ ! -f " $wim " ] && wim=$( find " $src " -maxdepth 1 -type f -iname boot.esd | head -n 1 )
901+ wim=$( find " $src " -maxdepth 1 -type f -iname boot.wim -print -quit )
902+ [ ! -f " $wim " ] && wim=$( find " $src " -maxdepth 1 -type f -iname boot.esd -print -quit )
903903
904904 if [ ! -f " $wim " ]; then
905905 error " failed to locate 'boot.wim' or 'boot.esd' in ISO image, $FB " && return 1
@@ -962,7 +962,7 @@ updateImage() {
962962
963963 local find=" $file "
964964 [[ " $MANUAL " == [Yy1]* ]] && find=" $org "
965- path=$( find " $dir " -maxdepth 1 -type f -iname " $find " | head -n 1 )
965+ path=$( find " $dir " -maxdepth 1 -type f -iname " $find " -print -quit )
966966
967967 if [ -f " $path " ]; then
968968 if [[ " $MANUAL " != [Yy1]* ]]; then
0 commit comments