mirror of
https://github.com/dockur/windows.git
synced 2024-11-15 01:34:41 +00:00
feat: Match files case insensitive (#172)
This commit is contained in:
parent
7e970a8e18
commit
8c148ebbf1
@ -90,15 +90,9 @@ if [[ "${VERSION,,}" == "tiny10" ]]; then
|
|||||||
VERSION="https://archive.org/download/tiny-10-23-h2/tiny10%20x64%2023h2.iso"
|
VERSION="https://archive.org/download/tiny-10-23-h2/tiny10%20x64%2023h2.iso"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CUSTOM="custom.iso"
|
CUSTOM=$(find "$STORAGE" -maxdepth 1 -type f -iname custom.iso -printf "%f\n" | head -n 1)
|
||||||
|
[ -z "$CUSTOM" ] && CUSTOM=$(find "$STORAGE" -maxdepth 1 -type f -iname boot.iso -printf "%f\n" | head -n 1)
|
||||||
[ ! -f "$STORAGE/$CUSTOM" ] && CUSTOM="Custom.iso"
|
[ -z "$CUSTOM" ] && CUSTOM=$(find "$STORAGE" -maxdepth 1 -type f -iname custom.img -printf "%f\n" | head -n 1)
|
||||||
[ ! -f "$STORAGE/$CUSTOM" ] && CUSTOM="custom.ISO"
|
|
||||||
[ ! -f "$STORAGE/$CUSTOM" ] && CUSTOM="CUSTOM.ISO"
|
|
||||||
[ ! -f "$STORAGE/$CUSTOM" ] && CUSTOM="custom.img"
|
|
||||||
[ ! -f "$STORAGE/$CUSTOM" ] && CUSTOM="Custom.img"
|
|
||||||
[ ! -f "$STORAGE/$CUSTOM" ] && CUSTOM="custom.IMG"
|
|
||||||
[ ! -f "$STORAGE/$CUSTOM" ] && CUSTOM="CUSTOM.IMG"
|
|
||||||
|
|
||||||
ESD_URL=""
|
ESD_URL=""
|
||||||
MACHINE="q35"
|
MACHINE="q35"
|
||||||
@ -205,31 +199,6 @@ getVersion() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
replaceXML() {
|
|
||||||
|
|
||||||
local dir="$1"
|
|
||||||
local asset="$2"
|
|
||||||
|
|
||||||
local path="$dir/autounattend.xml"
|
|
||||||
[ -f "$path" ] && cp "$asset" "$path"
|
|
||||||
path="$dir/Autounattend.xml"
|
|
||||||
[ -f "$path" ] && cp "$asset" "$path"
|
|
||||||
path="$dir/AutoUnattend.xml"
|
|
||||||
[ -f "$path" ] && cp "$asset" "$path"
|
|
||||||
path="$dir/autounattend.XML"
|
|
||||||
[ -f "$path" ] && cp "$asset" "$path"
|
|
||||||
path="$dir/Autounattend.XML"
|
|
||||||
[ -f "$path" ] && cp "$asset" "$path"
|
|
||||||
path="$dir/AutoUnattend.XML"
|
|
||||||
[ -f "$path" ] && cp "$asset" "$path"
|
|
||||||
path="$dir/AUTOUNATTEND.xml"
|
|
||||||
[ -f "$path" ] && cp "$asset" "$path"
|
|
||||||
path="$dir/AUTOUNATTEND.XML"
|
|
||||||
[ -f "$path" ] && cp "$asset" "$path"
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
hasDisk() {
|
hasDisk() {
|
||||||
|
|
||||||
[ -b "${DEVICE:-}" ] && return 0
|
[ -b "${DEVICE:-}" ] && return 0
|
||||||
@ -313,6 +282,7 @@ startInstall() {
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
[[ "${BASE,,}" == "boot."* ]] && BASE="windows.iso"
|
||||||
[[ "${BASE,,}" == "custom."* ]] && BASE="windows.iso"
|
[[ "${BASE,,}" == "custom."* ]] && BASE="windows.iso"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
@ -681,12 +651,19 @@ detectImage() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
local src=$(find "$dir" -maxdepth 1 -type d -iname sources | head -n 1)
|
||||||
|
|
||||||
|
if [ ! -d "$src" ]; then
|
||||||
|
warn "failed to locate 'sources' folder in ISO image, $FB"
|
||||||
|
BOOT_MODE="windows_legacy"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
local tag result name name2 desc
|
local tag result name name2 desc
|
||||||
local loc="$dir/sources/install.wim"
|
local loc=$(find "$src" -maxdepth 1 -type f -iname install.wim | head -n 1)
|
||||||
[ ! -f "$loc" ] && loc="$dir/sources/install.esd"
|
[ ! -f "$loc" ] && loc=$(find "$src" -maxdepth 1 -type f -iname install.esd | head -n 1)
|
||||||
|
|
||||||
if [ ! -f "$loc" ]; then
|
if [ ! -f "$loc" ]; then
|
||||||
|
|
||||||
warn "failed to locate 'install.wim' or 'install.esd' in ISO image, $FB"
|
warn "failed to locate 'install.wim' or 'install.esd' in ISO image, $FB"
|
||||||
BOOT_MODE="windows_legacy"
|
BOOT_MODE="windows_legacy"
|
||||||
return 1
|
return 1
|
||||||
@ -786,17 +763,10 @@ prepareXP() {
|
|||||||
sed -i '/^\[SCSI\]/s/$/\niaStor=\"Intel\(R\) SATA RAID\/AHCI Controller\"/' "$target/TXTSETUP.SIF"
|
sed -i '/^\[SCSI\]/s/$/\niaStor=\"Intel\(R\) SATA RAID\/AHCI Controller\"/' "$target/TXTSETUP.SIF"
|
||||||
sed -i '/^\[HardwareIdsDatabase\]/s/$/\nPCI\\VEN_8086\&DEV_2922\&CC_0106=\"iaStor\"/' "$target/TXTSETUP.SIF"
|
sed -i '/^\[HardwareIdsDatabase\]/s/$/\nPCI\\VEN_8086\&DEV_2922\&CC_0106=\"iaStor\"/' "$target/TXTSETUP.SIF"
|
||||||
|
|
||||||
rm -f "$target/winnt.sif"
|
|
||||||
rm -f "$target/Winnt.sif"
|
|
||||||
rm -f "$target/winnt.SIF"
|
|
||||||
rm -f "$target/WinNT.sif"
|
|
||||||
rm -f "$target/WINNT.sif"
|
|
||||||
rm -f "$target/WINNT.SIF"
|
|
||||||
|
|
||||||
local key="M6TF9-8XQ2M-YQK9F-7TBB2-XGG88"
|
local key="M6TF9-8XQ2M-YQK9F-7TBB2-XGG88"
|
||||||
[[ "${arch,,}" == "amd64" ]] && key="B66VY-4D94T-TPPD4-43F72-8X4FY"
|
[[ "${arch,,}" == "amd64" ]] && key="B66VY-4D94T-TPPD4-43F72-8X4FY"
|
||||||
|
|
||||||
local sif="$target/WINNT.SIF"
|
find "$target" -maxdepth 1 -type f -iname winnt.sif -exec rm {} \;
|
||||||
|
|
||||||
{ echo "[Data]"
|
{ echo "[Data]"
|
||||||
echo "AutoPartition=1"
|
echo "AutoPartition=1"
|
||||||
@ -851,8 +821,9 @@ prepareXP() {
|
|||||||
echo ""
|
echo ""
|
||||||
echo "[TerminalServices]"
|
echo "[TerminalServices]"
|
||||||
echo "AllowConnections=1"
|
echo "AllowConnections=1"
|
||||||
} | unix2dos > "$sif"
|
} | unix2dos > "$target/WINNT.SIF"
|
||||||
|
|
||||||
|
rm -rf "$drivers"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -864,6 +835,8 @@ prepareLegacy() {
|
|||||||
ETFS="boot.img"
|
ETFS="boot.img"
|
||||||
BOOT_MODE="windows_legacy"
|
BOOT_MODE="windows_legacy"
|
||||||
|
|
||||||
|
rm -f "$dir/$ETFS"
|
||||||
|
|
||||||
local len offset
|
local len offset
|
||||||
len=$(isoinfo -d -i "$iso" | grep "Nsect " | grep -o "[^ ]*$")
|
len=$(isoinfo -d -i "$iso" | grep "Nsect " | grep -o "[^ ]*$")
|
||||||
offset=$(isoinfo -d -i "$iso" | grep "Bootoff " | grep -o "[^ ]*$")
|
offset=$(isoinfo -d -i "$iso" | grep "Bootoff " | grep -o "[^ ]*$")
|
||||||
@ -922,10 +895,20 @@ updateImage() {
|
|||||||
local index result
|
local index result
|
||||||
|
|
||||||
[ ! -f "$asset" ] && return 0
|
[ ! -f "$asset" ] && return 0
|
||||||
replaceXML "$dir" "$asset"
|
|
||||||
|
|
||||||
local loc="$dir/sources/boot.wim"
|
local path=$(find "$dir" -maxdepth 1 -type f -iname autounattend.xml | head -n 1)
|
||||||
[ ! -f "$loc" ] && loc="$dir/sources/boot.esd"
|
[ -n "$path" ] && cp "$asset" "$path"
|
||||||
|
|
||||||
|
local src=$(find "$dir" -maxdepth 1 -type d -iname sources | head -n 1)
|
||||||
|
|
||||||
|
if [ ! -d "$src" ]; then
|
||||||
|
warn "failed to locate 'sources' folder in ISO image, $FB"
|
||||||
|
BOOT_MODE="windows_legacy"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local loc=$(find "$src" -maxdepth 1 -type f -iname boot.wim | head -n 1)
|
||||||
|
[ ! -f "$loc" ] && loc=$(find "$src" -maxdepth 1 -type f -iname boot.esd | head -n 1)
|
||||||
|
|
||||||
if [ ! -f "$loc" ]; then
|
if [ ! -f "$loc" ]; then
|
||||||
warn "failed to locate 'boot.wim' or 'boot.esd' in ISO image, $FB"
|
warn "failed to locate 'boot.wim' or 'boot.esd' in ISO image, $FB"
|
||||||
|
Loading…
Reference in New Issue
Block a user