#!/bin/sh
#
# How to use this test
# --------------------
#
# * Get a working Windows OS on your network
# * Install strawberry perl version with msi
#   http://www.bareos.org/downloads/depkgs-mingw32/strawberry-perl-5.10.1.0.msi
# * Install the latest version of Bareos FD
# * Copy or make accessible (Network share, VirtualBox share)
#     regress/scripts/regress-win32.pl
# * Execute the script on the Windows box
#     perl regress-win32.pl
# * Run this script with the proper config settings about WIN32
#
TestName="win32-systemstate-test"
. scripts/functions

scripts/cleanup
scripts/copy-test-confs
cp scripts/win32-bareos-dir.conf bin/bareos-dir.conf

URL=http://$WIN32_ADDR:8091
wget -qO $tmp/stop.log "$URL/stop"
wget -qO $tmp/update.log "$URL/set_director_name?name=$HOST-dir;pass=$WIN32_PASSWORD"
wget -qO $tmp/start.log "$URL/start"

start_test

cat <<END_OF_DATA >${cwd}/tmp/bconcmds
@output
messages
@$out ${cwd}/tmp/log1.out
status client=$WIN32_CLIENT
label storage=File volume=TestVolume001
run job=SystemstateJob storage=File yes
wait
messages
@#
@# now do a restore
@#
@$out ${cwd}/tmp/log2.out
restore where=/ storage=File
cd @SYSTEMSTATE
m Reg*
done
yes
wait
messages
quit
END_OF_DATA

run_bareos
check_for_zombie_jobs storage=File
stop_bareos

check_two_logs
end_test
