Commit 718828a0 authored by Nikos Skalkotos's avatar Nikos Skalkotos
Browse files

Use check_yes_no on all boolean img properties

Fix the code for OFFLINE_NTFSRESIZE and OFFLINE_NTFSRESIZE_NOCHECK
image properties.
parent 3be9e215
......@@ -177,19 +177,18 @@ All image formats properties
one. See :ref:`Overwriting Configuration Tasks<overwriting-configuration-tasks>`
for more info.
* **OFFLINE_NTFSRESIZE**
When deploying a Windows Image, perform an offline NTFS resize, instead
of setting up the Unattend.xml file so SYSPREP executes a custom DISKPART
script to perform an online resize during the first boot. Note NTFS is
left dirty and will be checked automatically on first boot when performing
an offline NTFS resize. Define the *OFFLINE_NTFSRESIZE_NOCHECK* property
to a non-empty value to disable this behavior (this is dangerous).
For more information on "answer files" please refer to
:ref:`windows-deployment`.
* **OFFLINE_NTFSRESIZE_NOCHECK**
Set this property to a non-empty value to skip the NTFS check performed by
Windows upon the first boot when performing an offline NTFS resize (see the
* **OFFLINE_NTFSRESIZE=yes**
When deploying a Windows Image, perform an offline NTFS resize, instead of
setting up the Unattend.xml file so SYSPREP executes a custom DISKPART
script to perform an online resize during the first boot. Note NTFS is left
dirty and will be checked automatically on first boot when performing an
offline NTFS resize. Set the *OFFLINE_NTFSRESIZE_NOCHECK* property to yes to
disable this behavior (this is dangerous). For more information on "answer
files" please refer to :ref:`windows-deployment`.
* **OFFLINE_NTFSRESIZE_NOCHECK=yes**
Set this property to yes to skip the NTFS check performed by Windows upon
the first boot when performing an offline NTFS resize (see the
*OFFLINE_NTFSRESIZE* property). Skipping the initial filesystem check is
dangerous, as it may lead to bugs of the offline NTFS resize procedure going
undetected.
......
......@@ -86,13 +86,13 @@ elif [[ "$ptype" == "freebsd-ufs" ]]; then
$GROWFS_UFS -y "$device"
elif [[ "$ptype" == "ntfs" ]]; then
# For NTFS, only perform an offline resize if forced
if [ -n "$SNF_IMAGE_PROPERTY_OFFLINE_NTFSRESIZE" ]; then
if check_yes_no SNF_IMAGE_PROPERTY_OFFLINE_NTFSRESIZE; then
# Be extra safe: Refuse to work on Image with a dirty NTFS
if ! $NTFSINFO -m "$device"; then
log_error "NTFS is dirty, refusing to continue"
fi
$NTFSRESIZE -f "$device"
if [ -n "$SNF_IMAGE_PROPERTY_OFFLINE_NTFSRESIZE_NOCHECK" ]; then
if check_yes_no SNF_IMAGE_PROPERTY_OFFLINE_NTFSRESIZE_NOCHECK; then
warn "Clearing dirty bit after NTFS resize"
warn "Please run CHKDSK manually after boot"
$NTFSFIX -d "$device"
......
......@@ -57,7 +57,7 @@ ptype=$(cut -d: -f5 <<< "$partition")
device="${SNF_IMAGE_DEV}${id}"
if [ "$ptype" = "ntfs" -a "$SNF_IMAGE_PROPERTY_OSFAMILY" = "windows" ]; then
if [ -n "$SNF_IMAGE_PROPERTY_OFFLINE_NTFSRESIZE" ]; then
if check_yes_no SNF_IMAGE_PROPERTY_OFFLINE_NTFSRESIZE; then
warn "Task ${PROGNAME:2} will not run. Offline NTFS resize requested."
exit 0
fi
......@@ -66,7 +66,7 @@ if [ "$ptype" = "ntfs" -a "$SNF_IMAGE_PROPERTY_OSFAMILY" = "windows" ]; then
sysprepinf=$(get_sysprepinf "$target")
if [ -n "$sysprepinf" ]; then
warn "Found SYSPREP.INF. Cannot perform online resize on XP / Server 2003."
warn "Set the OFFLINE_NTFSRESIZE property to request an offline resize."
warn "Set the OFFLINE_NTFSRESIZE property to yes to request an offline resize."
fi
# Write a diskpart script to %SystemDrive%\Windows\SnfScripts. Sysprep will
......
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