mirror of
https://github.com/dockur/windows.git
synced 2025-10-29 12:15:50 +00:00
Update install.sh
This commit is contained in:
parent
58684f6b35
commit
4da3a90463
1 changed files with 16 additions and 21 deletions
|
|
@ -12,10 +12,8 @@ hasDisk() {
|
||||||
[ -b "/disk1" ] && return 0
|
[ -b "/disk1" ] && return 0
|
||||||
[ -b "/dev/disk1" ] && return 0
|
[ -b "/dev/disk1" ] && return 0
|
||||||
[ -b "${DEVICE:-}" ] && return 0
|
[ -b "${DEVICE:-}" ] && return 0
|
||||||
|
[ -s "$STORAGE/data.img" ] && return 0
|
||||||
if [ -s "$STORAGE/data.img" ] || [ -s "$STORAGE/data.qcow2" ]; then
|
[ -s "$STORAGE/data.qcow2" ] && return 0
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
@ -23,39 +21,36 @@ hasDisk() {
|
||||||
skipInstall() {
|
skipInstall() {
|
||||||
|
|
||||||
local iso="$1"
|
local iso="$1"
|
||||||
|
local magic byte
|
||||||
local previous="$STORAGE/windows.base"
|
local previous="$STORAGE/windows.base"
|
||||||
|
|
||||||
if [ -f "$previous" ]; then
|
if [ -f "$previous" ]; then
|
||||||
previous=$(<"$previous")
|
previous=$(<"$previous")
|
||||||
if [ -n "$previous" ]; then
|
if [ -n "$previous" ]; then
|
||||||
previous="$STORAGE/$previous"
|
previous="$STORAGE/$previous"
|
||||||
|
if [[ "${previous,,}" != "${iso,,}" ]]; then
|
||||||
|
|
||||||
|
fi
|
||||||
if [ -f "$previous" ]; then
|
if [ -f "$previous" ]; then
|
||||||
rm -f "$previous" || true
|
rm -f "$previous" || true
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if hasDisk && [ -f "$STORAGE/windows.boot" ]; then
|
[ -f "$STORAGE/windows.boot" ] && hasDisk && return 0
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f "$iso" ] && [ -s "$iso" ]; then
|
[ ! -f "$iso" ] && return 1
|
||||||
|
[ ! -s "$iso" ] && return 1
|
||||||
|
|
||||||
local magic byte
|
# Check if the ISO was already processed by our script
|
||||||
# Check if the ISO was already processed by our script
|
magic=$(dd if="$iso" seek=0 bs=1 count=1 status=none | tr -d '\000')
|
||||||
magic=$(dd if="$iso" seek=0 bs=1 count=1 status=none | tr -d '\000')
|
magic="$(printf '%s' "$magic" | od -A n -t x1 -v | tr -d ' \n')"
|
||||||
magic="$(printf '%s' "$magic" | od -A n -t x1 -v | tr -d ' \n')"
|
byte="16" && [[ "$MANUAL" == [Yy1]* ]] && byte="17"
|
||||||
byte="16" && [[ "$MANUAL" == [Yy1]* ]] && byte="17"
|
|
||||||
|
|
||||||
if [[ "$magic" == "$byte" ]]; then
|
[[ "$magic" != "$byte" ]] && return 1
|
||||||
if [ -z "$CUSTOM" ] || [ -n "$ORIGINAL" ]; then
|
[ -n "$CUSTOM" ] && [ -z "$ORIGINAL" ] && return 1
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
return 0
|
||||||
|
|
||||||
return 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
startInstall() {
|
startInstall() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue