#! /bin/sh
### BEGIN INIT INFO
# Provides:          gdm-sync-config
# Required-Start:
# Required-Stop:
# Should-Stop:       halt reboot kexec
# Default-Start:
# Default-Stop:      0 6
# Short-Description: sync gdm config from xfconf
### END INIT INFO

PATH=/sbin:/bin
. /lib/init/vars.sh

. /lib/lsb/init-functions

sync () {

	if [ -e /tmp/xkb_disable ]; then
	cp /tmp/xkb_disable /var/lib/gdm/
	fi	

	if [ -e /tmp/xkb_layout ]; then
	cp /tmp/xkb_layout /var/lib/gdm/
	fi

	if [ -e /tmp/xkb_variant ]; then
	cp /tmp/xkb_variant /var/lib/gdm/
	fi

}

case "$1" in
  start)
	# No-op
	;;
  restart|reload|force-reload)
	echo "Error: argument '$1' not supported" >&2
	exit 3
	;;
  stop)
	sync
	;;
  *)
	echo "Usage: $0 start|stop" >&2
	exit 3
	;;
esac
