From 8f2e9ab0cc057c66394356db4a88d76e18336aef Mon Sep 17 00:00:00 2001 From: Kroese Date: Sun, 13 Oct 2024 10:22:20 +0200 Subject: [PATCH 1/5] Update define.sh --- src/define.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/define.sh b/src/define.sh index cd214df12..a8aea4948 100644 --- a/src/define.sh +++ b/src/define.sh @@ -1665,7 +1665,7 @@ prepareInstall() { local arch="$4" local key="$5" local driver="$6" - local drivers="/run/shm/drivers" + local drivers="/tmp/drivers" rm -rf "$drivers" mkdir -p "$drivers" @@ -1723,8 +1723,8 @@ prepareInstall() { fi mkdir -p "$dir/\$OEM\$/\$1/Drivers/sata" - cp -a "$drivers/sata/xp/$arch/." "$dir/\$OEM\$/\$1/Drivers/sata" - cp -a "$drivers/sata/xp/$arch/." "$target" + cp -r "$drivers/sata/xp/$arch/." "$dir/\$OEM\$/\$1/Drivers/sata" + cp -r "$drivers/sata/xp/$arch/." "$target" sed -i '/^\[SCSI.Load\]/s/$/\niaStor=iaStor.sys,4/' "$target/TXTSETUP.SIF" sed -i '/^\[FileFlags\]/s/$/\niaStor.sys = 16/' "$target/TXTSETUP.SIF" @@ -1963,10 +1963,10 @@ prepareInstall() { msg="Adding OEM folder to image..." info "$msg" && html "$msg" - local dest="$dir/\$OEM\$/\$1/" + local dest="$dir/\$OEM\$/\$1/OEM" mkdir -p "$dest" - if ! cp -r "$folder" "$dest"; then + if ! cp -r "$folder/." "$dest"; then error "Failed to copy OEM folder!" && return 1 fi From dfbe9078e93920e192dbe44cd00d4f8c3af3acda Mon Sep 17 00:00:00 2001 From: Kroese Date: Sun, 13 Oct 2024 10:38:56 +0200 Subject: [PATCH 2/5] Update define.sh --- src/define.sh | 58 +++++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/src/define.sh b/src/define.sh index a8aea4948..c1e3e04b0 100644 --- a/src/define.sh +++ b/src/define.sh @@ -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" @@ -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" @@ -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 } From dd332525c74268835fed00912da766a3677c904c Mon Sep 17 00:00:00 2001 From: Kroese Date: Sun, 13 Oct 2024 10:40:59 +0200 Subject: [PATCH 3/5] Update install.sh --- src/install.sh | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/src/install.sh b/src/install.sh index 32f2f6883..ce3278384 100644 --- a/src/install.sh +++ b/src/install.sh @@ -756,7 +756,7 @@ addDrivers() { # Workaround Virtio GPU driver bug local dst="$src/\$OEM\$/\$\$/Drivers" mkdir -p "$dst" - ! cp -a "$dest/." "$dst" && return 1 + ! cp -r "$dest/." "$dst" && return 1 rm -rf "$dest/viogpudo" ;; esac @@ -769,37 +769,12 @@ addDrivers() { 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() { local dir="$1" local asset="$2" local language="$3" - local tmp="/run/shm/img" + local tmp="/tmp/install" local file="autounattend.xml" local org="${file//.xml/.org}" local dat="${file//.xml/.dat}" From 11d153d2be86810e971eca6bd5f97f9b4192f70e Mon Sep 17 00:00:00 2001 From: Kroese Date: Sun, 13 Oct 2024 11:13:42 +0200 Subject: [PATCH 4/5] Update define.sh --- src/define.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/define.sh b/src/define.sh index c1e3e04b0..1b4bd77bc 100644 --- a/src/define.sh +++ b/src/define.sh @@ -1653,7 +1653,7 @@ addFolder() { local dest="$src/\$OEM\$/\$1/OEM" mkdir -p "$dest" - ! cp -r "$folder/." "$dest" && return 1 + ! cp -Lr "$folder/." "$dest" && return 1 local file file=$(find "$dest" -maxdepth 1 -type f -iname install.bat | head -n 1) @@ -1748,8 +1748,8 @@ prepareInstall() { fi mkdir -p "$dir/\$OEM\$/\$1/Drivers/sata" - cp -r "$drivers/sata/xp/$arch/." "$dir/\$OEM\$/\$1/Drivers/sata" - cp -r "$drivers/sata/xp/$arch/." "$target" + cp -Lr "$drivers/sata/xp/$arch/." "$dir/\$OEM\$/\$1/Drivers/sata" + cp -Lr "$drivers/sata/xp/$arch/." "$target" sed -i '/^\[SCSI.Load\]/s/$/\niaStor=iaStor.sys,4/' "$target/TXTSETUP.SIF" sed -i '/^\[FileFlags\]/s/$/\niaStor.sys = 16/' "$target/TXTSETUP.SIF" From 7b001ca1c64423866b3671129ce6643b1d98870e Mon Sep 17 00:00:00 2001 From: Kroese Date: Sun, 13 Oct 2024 11:23:15 +0200 Subject: [PATCH 5/5] Update install.sh --- src/install.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/install.sh b/src/install.sh index ce3278384..f6cad161d 100644 --- a/src/install.sh +++ b/src/install.sh @@ -704,8 +704,9 @@ addDriver() { esac local dest="$path/$target/$driver" - mv "$path/$driver/$folder" "$dest" + mkdir -p "$dest" + cp -Lr "$path/$driver/$folder/." "$dest" return 0 } @@ -756,7 +757,7 @@ addDrivers() { # Workaround Virtio GPU driver bug local dst="$src/\$OEM\$/\$\$/Drivers" mkdir -p "$dst" - ! cp -r "$dest/." "$dst" && return 1 + ! cp -Lr "$dest/." "$dst" && return 1 rm -rf "$dest/viogpudo" ;; esac