Skip to content

Commit

Permalink
Update define.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
kroese authored Oct 13, 2024
1 parent 8f2e9ab commit dfbe907
Showing 1 changed file with 31 additions and 27 deletions.
58 changes: 31 additions & 27 deletions src/define.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1637,6 +1637,31 @@ validVersion() {
return 1
}

addFolder() {

local src="$1"
local folder="/oem"

[ ! -d "$folder" ] && folder="/OEM"
[ ! -d "$folder" ] && folder="$STORAGE/oem"
[ ! -d "$folder" ] && folder="$STORAGE/OEM"
[ ! -d "$folder" ] && return 0

local msg="Adding OEM folder to image..."
info "$msg" && html "$msg"

local dest="$src/\$OEM\$/\$1/OEM"
mkdir -p "$dest"

! cp -r "$folder/." "$dest" && return 1

local file
file=$(find "$dest" -maxdepth 1 -type f -iname install.bat | head -n 1)
[ -f "$file" ] && unix2dos -q "$file"

return 0
}

migrateFiles() {

local base="$1"
Expand Down Expand Up @@ -1749,23 +1774,14 @@ prepareInstall() {
warn "this version of $desc requires a volume license key (VLK), it will ask for one during installation."
fi

local oem=""
local folder="/oem"

[ ! -d "$folder" ] && folder="/OEM"
[ ! -d "$folder" ] && folder="$STORAGE/oem"
[ ! -d "$folder" ] && folder="$STORAGE/OEM"

if [ -d "$folder" ]; then

file=$(find "$folder" -maxdepth 1 -type f -iname install.bat | head -n 1)

if [ -f "$file" ]; then
unix2dos -q "$file"
oem="\"Script\"=\"cmd /C start \\\"Install\\\" \\\"cmd /C C:\\\\OEM\\\\install.bat\\\"\""
fi
if ! addFolder "$dir"; then
error "Failed to add OEM folder to image!" && return 1
fi

local oem=""
local install="$dir/\$OEM\$/\$1/OEM/install.bat"
[ -f "$install" ] && oem="\"Script\"=\"cmd /C start \\\"Install\\\" \\\"cmd /C C:\\\\OEM\\\\install.bat\\\"\""

[ -z "$YRES" ] && YRES="720"
[ -z "$XRES" ] && XRES="1280"

Expand Down Expand Up @@ -1958,18 +1974,6 @@ prepareInstall() {
echo ""
} | unix2dos > "$dir/\$OEM\$/cmdlines.txt"

[ ! -d "$folder" ] && return 0

msg="Adding OEM folder to image..."
info "$msg" && html "$msg"

local dest="$dir/\$OEM\$/\$1/OEM"
mkdir -p "$dest"

if ! cp -r "$folder/." "$dest"; then
error "Failed to copy OEM folder!" && return 1
fi

return 0
}

Expand Down

0 comments on commit dfbe907

Please sign in to comment.