Commit 8689d50f authored by Nikos Skalkotos's avatar Nikos Skalkotos
Browse files

Add mechanism for using a custom unattend.xml

snf-image-helper by default uses it's own version of unattend.xml file,
but if UNATTEND variable is specified then it will use the one provided
by snf-image-host.
parent 822ba661
......@@ -46,6 +46,10 @@ else
log_error "Floppy does not contain \`rules\' file"
fi
if [ -f "$floppy/unattend.xml" ]; then
export SNF_IMAGE_UNATTEND="$floppy/unattend.xml"
fi
if [ -n "$SNF_IMAGE_PROPERTIES" ]; then
properties=$(mktemp --tmpdir properties.XXXXXX)
add_cleanup rm "$properties"
......
......@@ -42,7 +42,17 @@ fi
target=$SNF_IMAGE_TARGET
mkdir -p "$target/Windows/Setup/Scripts"
cat "@commondir@/unattend.xml" > "$target/Unattend.xml"
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
cat "@commondir@/unattend.xml" > "$target/Unattend.xml"
fi
echo "del /Q /F C:\Unattend.xml" > \
"$target/Windows/Setup/Scripts/SetupComplete.cmd"
......
......@@ -47,6 +47,7 @@ edit = sed \
-e 's|@QEMU_IMG[@]|$(QEMU_IMG)|g' \
-e 's|@INSTALL_MBR[@]|$(INSTALL_MBR)|g' \
-e 's|@PROGRESS_MONITOR[@]|$(PROGRESS_MONITOR)|g' \
-e 's|@UNATTEND[@]|$(UNATTEND)|g' \
-e 's|@progress_monitor_support[@]|$(progress_monitor_support)|g' \
-e 's|@pithos_backend_support[@]|$(pithos_backend_support)|g' \
-e 's|@network_backend_support[@]|$(network_backend_support)|g'
......
......@@ -179,6 +179,13 @@ create_floppy() {
mount "$img" "$target" -o loop
set | egrep ^snf_export_\\w+= | sed -e 's/^snf_export_/export SNF_IMAGE_/' \
> "$target/rules"
if [ -n "$UNATTEND" ]; then
if [ -f "$UNATTEND" ]; then
cat "$UNATTEND" > "$target/unattend.xml"
else
log_error "Unattend file: \`"$UNATTEND"' does not exist"
fi
fi
umount "$target"
}
......@@ -340,6 +347,7 @@ fi
: ${PITHOS_DB:="sqlite:////@localstatedir@/lib/pithos/backend.db"}
: ${PITHOS_DATA:="@localstatedir@/lib/pithos/data/"}
: ${PROGRESS_MONITOR:="@PROGRESS_MONITOR@"}
: ${UNATTEND:="@UNATTEND@"}
SCRIPT_NAME=$(basename $0)
......
......@@ -26,19 +26,30 @@ AM_CONDITIONAL(NETWORKIMGSUPPORT, [test "x$enable_network_backend" = "xyes"])
# --with-progress-monitor
AC_ARG_WITH([progress-monitor],
[AS_HELP_STRING([--with-progress-monitor=PRGRM_PATH],
[path to progress-monitor program []])],
[AS_HELP_STRING([--with-progress-monitor=PRGRM],
[name of the progress-monitor program []])],
[if test "$withval" != "yes" -a "$withval" != "no"; then
AC_PATH_PROG(PROGRESS_MONITOR, ["$withval"], [], [$PATH:/usr/sbin:/sbin])
if test -z "$PROGRESS_MONITOR" ; then
AC_MSG_FAILURE([Could not find progress-monitor: $withval.])
fi
PROGRESS_MONITOR="$withval"
elif test "$withval" != "no"; then
AC_MSG_ERROR([you must specify a value for progress-monitor if --with-progress-monitor is specified])
fi]
)
# --with-unattend-file
AC_ARG_WITH([unattend-file],
[AS_HELP_STRING([--with-unattend-file=UNATTEND_PATH],
[path to unattend.xml windows setup file []])],
[if test "$withval" != "yes" -a "$withval" != "no"; then
AC_SUBST(UNATTEND, "$withval")
AC_MSG_NOTICE(using unattend file: $withval)
elif test "$withval" != "no"; then
AC_MSG_ERROR([you must specify an Unattend.xml file if --with-unattend-file is specified])
fi]
)
# --with-helper-dir
AC_ARG_WITH([helper-dir],
......
......@@ -72,6 +72,12 @@
# -i, which specifies the Ganeti instance name.
# PROGRESS_MONITOR=""
# UNATTEND: This variables overwrites the unattend.xml file used when deploying
# a windows image. snf-image-helper will use its own unattend.xml file if this
# variable is empty. Please unless you really know what you are doing, leave
# this empty.
# UNATTEND=""
# Paths for needed programs. Uncommend and change the variables below if you
# don't want to use the default one.
# LOSETUP="losetup"
......
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