Compare commits

...

4 Commits
v2.02 ... v2.03

Author SHA1 Message Date
Kroese
01f9603c47 build: Update qemu-docker to 4.14 (#174) 2024-02-16 15:03:23 +01:00
Kroese
41bab9d16d fix: Shellcheck (#173) 2024-02-16 14:43:03 +01:00
Kroese
8c148ebbf1 feat: Match files case insensitive (#172) 2024-02-16 14:38:00 +01:00
Kroese
7e970a8e18 fix: Convert line endings (#171) 2024-02-16 12:32:06 +01:00
2 changed files with 37 additions and 53 deletions

View File

@@ -1,5 +1,5 @@
FROM scratch FROM scratch
COPY --from=qemux/qemu-docker:4.13 / / COPY --from=qemux/qemu-docker:4.14 / /
ARG DEBCONF_NOWARNINGS="yes" ARG DEBCONF_NOWARNINGS="yes"
ARG DEBIAN_FRONTEND "noninteractive" ARG DEBIAN_FRONTEND "noninteractive"

View File

@@ -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 tag result name name2 desc local src loc tag result name name2 desc
local loc="$dir/sources/install.wim" src=$(find "$dir" -maxdepth 1 -type d -iname sources | head -n 1)
[ ! -f "$loc" ] && loc="$dir/sources/install.esd"
if [ ! -d "$src" ]; then
warn "failed to locate 'sources' folder in ISO image, $FB"
BOOT_MODE="windows_legacy"
return 1
fi
loc=$(find "$src" -maxdepth 1 -type f -iname install.wim | head -n 1)
[ ! -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,18 +763,12 @@ 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"
echo "MsDosInitiated=\"0\"" echo "MsDosInitiated=\"0\""
echo "UnattendedInstall=\"Yes\"" echo "UnattendedInstall=\"Yes\""
@@ -850,8 +821,9 @@ prepareXP() {
echo "" echo ""
echo "[TerminalServices]" echo "[TerminalServices]"
echo "AllowConnections=1" echo "AllowConnections=1"
} > "$sif" } | unix2dos > "$target/WINNT.SIF"
rm -rf "$drivers"
return 0 return 0
} }
@@ -863,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 "[^ ]*$")
@@ -918,13 +892,23 @@ updateImage() {
local iso="$1" local iso="$1"
local dir="$2" local dir="$2"
local asset="/run/assets/$3" local asset="/run/assets/$3"
local index result local path src loc index result
[ ! -f "$asset" ] && return 0 [ ! -f "$asset" ] && return 0
replaceXML "$dir" "$asset"
local loc="$dir/sources/boot.wim" 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"
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
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"