Commit 9fca5245 authored by Nikos Skalkotos's avatar Nikos Skalkotos
Browse files

Don't overwrite C:\Unattend.xml in the windows

If unattend.xml is present in the windows image, use this one unless
USE_DEFAULT_UNATTEND is specified as an image property.
parent c94e12c6
...@@ -45,15 +45,23 @@ fi ...@@ -45,15 +45,23 @@ fi
mkdir -p "$target/Windows/Setup/Scripts" mkdir -p "$target/Windows/Setup/Scripts"
if [ -n "$SNF_IMAGE_UNATTEND" ]; then # Workaround to search for C:\Unattend.xml in an case insensitive way.
echo "Installing custom Unattend.xml file..." exists=$(find "$target"/ -maxdepth 1 -iname unattend.xml)
if [ -f "$SNF_IMAGE_UNATTEND" ]; then
cat "$SNF_IMAGE_UNATTEND" > "$target/Unattend.xml" if [ -n "$exists" -a -z "$SNF_IMAGE_PROPERTY_USE_DEFAULT_UNATTEND" ]; then
warn "Using the Unattend.xml file found in the image"
xargs rm -f <<< "$exists"
if [ -n "$SNF_IMAGE_UNATTEND" ]; then
echo "Installing custom Unattend.xml file..."
if [ -f "$SNF_IMAGE_UNATTEND" ]; then
cat "$SNF_IMAGE_UNATTEND" > "$target/Unattend.xml"
log_error "Custom unattend file: \`"$SNF_IMAGE_UNATTEND"' is missing"
else else
log_error "Custom unattend file: \`"$SNF_IMAGE_UNATTEND"' is missing" cat "@commondir@/unattend.xml" > "$target/Unattend.xml"
fi fi
cat "@commondir@/unattend.xml" > "$target/Unattend.xml"
fi fi
echo "del /Q /F C:\Unattend.xml" > \ echo "del /Q /F C:\Unattend.xml" > \
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment