feat: Add post-install command support (#1887)

This commit is contained in:
Kroese
2026-07-19 00:33:00 +02:00
committed by GitHub
parent c9e09156a5
commit 9409c06e32
3 changed files with 37 additions and 13 deletions
+22 -6
View File
@@ -1347,23 +1347,39 @@ validVersion() {
addFolder() {
local src="$1"
local folder="/oem"
local folder="/oem" file=""
local dest="$src/\$OEM\$/\$1/OEM"
[ ! -d "$folder" ] && folder="/OEM"
[ ! -d "$folder" ] && folder="$STORAGE/oem"
[ ! -d "$folder" ] && folder="$STORAGE/OEM"
[ ! -d "$folder" ] && return 0
[ ! -d "$folder" ] && folder=""
local msg="Adding OEM folder to image..."
[ -z "$folder" ] && [ -z "$COMMAND" ] && return 0
local msg="Adding OEM files to image..."
info "$msg" && html "$msg"
local dest="$src/\$OEM\$/\$1/OEM"
mkdir -p "$dest" || return 1
cp -Lr "$folder/." "$dest" || return 1
local file
if [ -n "$folder" ]; then
cp -Lr "$folder/." "$dest" || return 1
fi
file=$(find "$dest" -maxdepth 1 -type f -iname install.bat -print -quit) || return 1
if [ -n "$COMMAND" ]; then
[ -z "$file" ] && file="$dest/install.bat"
if [ -s "$file" ]; then
printf '\n' >> "$file" || return 1
fi
printf '%s\n' "$COMMAND" >> "$file" || return 1
fi
if [ -f "$file" ]; then
if ! unix2dos -q "$file"; then
error "Failed to convert $file to DOS format!"