#!/bin/bash

# XXX uncovered: 
#zfcp
#iscsi-client

CONTROL="/control.xml"
TMP="/tmp/enable-dasd.run"

if [ -f "$TMP" ]; then
	# do not reboot
	rm -f /var/lib/YaST2/restart_yast
	# enable ask questions
	# XXX this is currently disabled as on s390, we do not support full
	# disk encryption
	#echo 1 > /tmp/next_dialog
	# exit as we already did the job
	exit 0
fi

touch $TMP

#perform multiline matching
perl -ne 'undef $/; s/<label>AutoYaST Settings<\/label>\s*\n\s*<name>autosetup<\/name>/<label>AutoYaST DASD<\/label>\n<name>dasd<\/name>\n<\/module>\n<module>\n<label>AutoYaST Settings<\/label>\n<name>autosetup<\/name>/; print' <$CONTROL >$CONTROL.$$
mv $CONTROL.$$ $CONTROL

# restart YaST
touch /var/lib/YaST2/restart_yast
# prevent all ask questions for this run
echo -1 > /tmp/next_dialog