#!/bin/sh

# Kills all wine processes
# 19.06.04, 05.07.04

DIALOG=Xdialog

signal_handler ()
{
	echo Kill all wine processes
	for i in "" "-9"
	do
		killall $i wine-kthread wine-pthread wine-preloader wineserver wine
		sleep 1
	done
	$DIALOG --infobox "Forced reboot completed" 0 0 7000
	exit
}

child_handler ()
{
	echo Child he-he
}

trap signal_handler SIGHUP SIGPIPE SIGINT SIGTERM
trap child_handler SIGCHLD
echo Try to do Internal wine reboot
echo Press Ctrl-C to force
/usr/bin/wineboot &
BOOTPID=$!
echo $BOOTPID
trap -p SIGCHLD
$DIALOG --cancel-label "Force" --infobox "Rebooting... Press Force to force reboot" 0 0 3000
res=$? ; echo $res
if [ "$res" == "1" ]
then
	signal_handler
fi

$DIALOG --infobox "Reboot completed" 0 0 10000
