mirror of
https://github.com/dockur/windows.git
synced 2024-11-24 17:24:37 +01:00
feat: Extract drivers to temporary folder (#803)
This commit is contained in:
parent
ff55f843bd
commit
3cab3d1c7b
@ -1637,6 +1637,31 @@ validVersion() {
|
|||||||
return 1
|
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 -Lr "$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() {
|
migrateFiles() {
|
||||||
|
|
||||||
local base="$1"
|
local base="$1"
|
||||||
@ -1665,7 +1690,7 @@ prepareInstall() {
|
|||||||
local arch="$4"
|
local arch="$4"
|
||||||
local key="$5"
|
local key="$5"
|
||||||
local driver="$6"
|
local driver="$6"
|
||||||
local drivers="/run/shm/drivers"
|
local drivers="/tmp/drivers"
|
||||||
|
|
||||||
rm -rf "$drivers"
|
rm -rf "$drivers"
|
||||||
mkdir -p "$drivers"
|
mkdir -p "$drivers"
|
||||||
@ -1723,8 +1748,8 @@ prepareInstall() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p "$dir/\$OEM\$/\$1/Drivers/sata"
|
mkdir -p "$dir/\$OEM\$/\$1/Drivers/sata"
|
||||||
cp -a "$drivers/sata/xp/$arch/." "$dir/\$OEM\$/\$1/Drivers/sata"
|
cp -Lr "$drivers/sata/xp/$arch/." "$dir/\$OEM\$/\$1/Drivers/sata"
|
||||||
cp -a "$drivers/sata/xp/$arch/." "$target"
|
cp -Lr "$drivers/sata/xp/$arch/." "$target"
|
||||||
|
|
||||||
sed -i '/^\[SCSI.Load\]/s/$/\niaStor=iaStor.sys,4/' "$target/TXTSETUP.SIF"
|
sed -i '/^\[SCSI.Load\]/s/$/\niaStor=iaStor.sys,4/' "$target/TXTSETUP.SIF"
|
||||||
sed -i '/^\[FileFlags\]/s/$/\niaStor.sys = 16/' "$target/TXTSETUP.SIF"
|
sed -i '/^\[FileFlags\]/s/$/\niaStor.sys = 16/' "$target/TXTSETUP.SIF"
|
||||||
@ -1749,22 +1774,13 @@ prepareInstall() {
|
|||||||
warn "this version of $desc requires a volume license key (VLK), it will ask for one during installation."
|
warn "this version of $desc requires a volume license key (VLK), it will ask for one during installation."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if ! addFolder "$dir"; then
|
||||||
|
error "Failed to add OEM folder to image!" && return 1
|
||||||
|
fi
|
||||||
|
|
||||||
local oem=""
|
local oem=""
|
||||||
local folder="/oem"
|
local install="$dir/\$OEM\$/\$1/OEM/install.bat"
|
||||||
|
[ -f "$install" ] && oem="\"Script\"=\"cmd /C start \\\"Install\\\" \\\"cmd /C C:\\\\OEM\\\\install.bat\\\"\""
|
||||||
[ ! -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
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ -z "$YRES" ] && YRES="720"
|
[ -z "$YRES" ] && YRES="720"
|
||||||
[ -z "$XRES" ] && XRES="1280"
|
[ -z "$XRES" ] && XRES="1280"
|
||||||
@ -1958,18 +1974,6 @@ prepareInstall() {
|
|||||||
echo ""
|
echo ""
|
||||||
} | unix2dos > "$dir/\$OEM\$/cmdlines.txt"
|
} | unix2dos > "$dir/\$OEM\$/cmdlines.txt"
|
||||||
|
|
||||||
[ ! -d "$folder" ] && return 0
|
|
||||||
|
|
||||||
msg="Adding OEM folder to image..."
|
|
||||||
info "$msg" && html "$msg"
|
|
||||||
|
|
||||||
local dest="$dir/\$OEM\$/\$1/"
|
|
||||||
mkdir -p "$dest"
|
|
||||||
|
|
||||||
if ! cp -r "$folder" "$dest"; then
|
|
||||||
error "Failed to copy OEM folder!" && return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -704,8 +704,9 @@ addDriver() {
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
local dest="$path/$target/$driver"
|
local dest="$path/$target/$driver"
|
||||||
mv "$path/$driver/$folder" "$dest"
|
mkdir -p "$dest"
|
||||||
|
|
||||||
|
cp -Lr "$path/$driver/$folder/." "$dest"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -756,7 +757,7 @@ addDrivers() {
|
|||||||
# Workaround Virtio GPU driver bug
|
# Workaround Virtio GPU driver bug
|
||||||
local dst="$src/\$OEM\$/\$\$/Drivers"
|
local dst="$src/\$OEM\$/\$\$/Drivers"
|
||||||
mkdir -p "$dst"
|
mkdir -p "$dst"
|
||||||
! cp -a "$dest/." "$dst" && return 1
|
! cp -Lr "$dest/." "$dst" && return 1
|
||||||
rm -rf "$dest/viogpudo"
|
rm -rf "$dest/viogpudo"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@ -769,37 +770,12 @@ addDrivers() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
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 -a "$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
|
|
||||||
}
|
|
||||||
|
|
||||||
updateImage() {
|
updateImage() {
|
||||||
|
|
||||||
local dir="$1"
|
local dir="$1"
|
||||||
local asset="$2"
|
local asset="$2"
|
||||||
local language="$3"
|
local language="$3"
|
||||||
local tmp="/run/shm/img"
|
local tmp="/tmp/install"
|
||||||
local file="autounattend.xml"
|
local file="autounattend.xml"
|
||||||
local org="${file//.xml/.org}"
|
local org="${file//.xml/.org}"
|
||||||
local dat="${file//.xml/.dat}"
|
local dat="${file//.xml/.dat}"
|
||||||
|
Loading…
Reference in New Issue
Block a user