mirror of
https://github.com/dockur/windows.git
synced 2025-10-29 12:15:50 +00:00
feat: Detect modified ISO
This commit is contained in:
parent
0d2a0d03d5
commit
8cf4278f87
1 changed files with 12 additions and 4 deletions
|
|
@ -31,7 +31,7 @@ skipInstall() {
|
||||||
|
|
||||||
startInstall() {
|
startInstall() {
|
||||||
|
|
||||||
html "Starting Windows..."
|
html "Starting $APP..."
|
||||||
|
|
||||||
if [ -n "$CUSTOM" ]; then
|
if [ -n "$CUSTOM" ]; then
|
||||||
|
|
||||||
|
|
@ -61,11 +61,19 @@ startInstall() {
|
||||||
|
|
||||||
# Check if the ISO was already processed by our script
|
# Check if the ISO was already processed by our script
|
||||||
local magic
|
local magic
|
||||||
local byte="16"
|
local auto="16"
|
||||||
[[ "$MANUAL" == [Yy1]* ]] && byte="17"
|
local manual="17"
|
||||||
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')"
|
||||||
|
|
||||||
|
if [[ "$magic" == "$auto" ]] || [[ "$magic" == "$manual" ]]; then
|
||||||
|
if [ -n "$CUSTOM" ] && [ -z "$ORIGINAL" ]; then
|
||||||
|
warn "this ISO file has already been modified by a previous installation!"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
local byte="$auto"
|
||||||
|
[[ "$MANUAL" == [Yy1]* ]] && byte="$manual"
|
||||||
[[ "$magic" == "$byte" ]] && return 1
|
[[ "$magic" == "$byte" ]] && return 1
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
@ -197,8 +205,8 @@ detectCustom() {
|
||||||
CUSTOM="$base"
|
CUSTOM="$base"
|
||||||
ORIGINAL="$file"
|
ORIGINAL="$file"
|
||||||
else
|
else
|
||||||
CUSTOM="$file"
|
|
||||||
rm -f "$base"
|
rm -f "$base"
|
||||||
|
CUSTOM="$file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue