Skip to content

Commit 71c9586

Browse files
authored
fix: Ignore missing custom .iso after install (#1180)
1 parent 81e9fff commit 71c9586

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

src/install.sh

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ EFISYS="efi/microsoft/boot/efisys_noprompt.bin"
1010
skipInstall() {
1111

1212
local iso="$1"
13+
local method=""
1314
local magic byte
1415
local boot="$STORAGE/windows.boot"
1516
local previous="$STORAGE/windows.base"
@@ -18,14 +19,22 @@ skipInstall() {
1819
previous=$(<"$previous")
1920
previous="${previous//[![:print:]]/}"
2021
if [ -n "$previous" ]; then
21-
previous="$STORAGE/$previous"
22-
if [[ "${previous,,}" != "${iso,,}" ]]; then
22+
if [[ "${STORAGE,,}/${previous,,}" != "${iso,,}" ]]; then
2323
if [ -f "$boot" ] && hasDisk; then
24-
info "Detected that the version was changed, but ignoring this because Windows is already installed."
25-
info "Please start with an empty /storage folder, if you want to install a different version of Windows."
24+
if [[ "${iso,,}" == "${STORAGE,,}/windows."* ]]; then
25+
method="your custom .iso file"
26+
else
27+
if [[ "${previous,,}" != "windows."* ]]; then
28+
method="the VERSION variable"
29+
fi
30+
fi
31+
if [ -n "$method" ]; then
32+
info "Detected that $method was changed, but ignoring this because Windows is already installed."
33+
info "Please start with an empty /storage folder, if you want to install a different version of Windows."
34+
fi
2635
return 0
2736
fi
28-
[ -f "$previous" ] && rm -f "$previous"
37+
rm -f "$STORAGE/$previous"
2938
return 1
3039
fi
3140
fi
@@ -200,13 +209,19 @@ abortInstall() {
200209

201210
detectCustom() {
202211

203-
local file base
212+
local dir file base
204213
local fname="custom.iso"
214+
local boot="$STORAGE/windows.boot"
205215

206216
CUSTOM=""
207217

208-
if [ -d "/$fname" ]; then
209-
error "The file /$fname does not exist, please make sure that you mapped it to a valid path!" && return 1
218+
dir=$(find / -maxdepth 1 -type d -iname "$fname" | head -n 1)
219+
[ ! -d "$dir" ] && dir=$(find "$STORAGE" -maxdepth 1 -type d -iname "$fname" | head -n 1)
220+
221+
if [ -d "$dir" ]; then
222+
if ! hasDisk || [ ! -f "$boot" ]; then
223+
error "The bind $dir maps to a file that does not exist!" && return 1
224+
fi
210225
fi
211226

212227
file=$(find / -maxdepth 1 -type f -iname "$fname" | head -n 1)
@@ -495,7 +510,7 @@ setXML() {
495510
local file="/custom.xml"
496511

497512
if [ -d "$file" ]; then
498-
warn "The file $file does not exist, please make sure that you mapped it to a valid path!"
513+
error "The bind $file maps to a file that does not exist!" && exit 67
499514
fi
500515

501516
[ ! -f "$file" ] || [ ! -s "$file" ] && file="$STORAGE/custom.xml"

0 commit comments

Comments
 (0)