Commit 878898d1 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 90db2151
......@@ -45,15 +45,23 @@ fi
target=$SNF_IMAGE_TARGET
mkdir -p "$target/Windows/Setup/Scripts"
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"
# Workaround to search for C:\Unattend.xml in an case insensitive way.
exists=$(find "$target"/ -maxdepth 1 -iname unattend.xml)
if [ -n "$exists" -a -z "$SNF_IMAGE_PROPERTY_USE_DEFAULT_UNATTEND" ]; then
warn "Using the Unattend.xml file found in the image"
else
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"
else
log_error "Custom unattend file: \`"$SNF_IMAGE_UNATTEND"' is missing"
fi
else
log_error "Custom unattend file: \`"$SNF_IMAGE_UNATTEND"' is missing"
cat "@commondir@/unattend.xml" > "$target/Unattend.xml"
fi
else
cat "@commondir@/unattend.xml" > "$target/Unattend.xml"
fi
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