#!/bin/sh
if [ $# -ne 1 -o "$1" = "-h" -o "$1" = "--help" ]
then
	echo "Usage: <YMP URL>"
	exit 1
fi
TEMPFILE=$(mktemp)
/usr/sbin/yast OneClickInstallCLI prepareinstall url=$1 targetfile=$TEMPFILE
if [ $? -ne 0 ]
then
	exit $?
fi

echo "Continue? y/N"
read continue
continue=${continue:="N"}
if [ $continue = "Y" ] ||  [ $continue = "y" ]
then
	su -c "/usr/sbin/yast OneClickInstallCLI doinstall instructionsfile=$TEMPFILE"
else
	exit 2 
fi
