#!/bin/bash
windows_device=/dev/sda1
default_image_file="/home/windows/user/Documents and Settings/Admin/My Documents/Backups/sda1.ntfsclone.gz"
image_file="${1:-"$default_image_file"}"

echo "
You are about to restore the Windows system partition (C:) from the backup file
$image_file.

This will undo *all* changes made to the Windows system partition since
$(date +%c -d @$(stat -c %Y "$image_file")).

Any documents or files saved in C: since then will be *permanently lost*.
Files deleted from C: since then will be restored. Files saved in D: will
not be affected."

read -p "
Is that what you want to do? " reply
reply="$(echo "$reply" | tr A-Z a-z)"
if [ "${reply:0:1}" = "y" ]
then
	sudo sh -c "
		umount '$windows_device'
		zcat '$image_file' | ntfsclone --restore-image -O '$windows_device' -
		mount -a
	"
	read -p "
Press Enter: "
fi
