#!/bin/sh -e

# Reconfigure X.org
if [ -e /target/var/lib/dpkg/info/xserver-xorg.postinst ]; then
	if [ -s /target/etc/X11/xorg.conf ]; then
		cp /target/etc/X11/xorg.conf /target/etc/X11/xorg.conf.orig
	fi

	in-target dpkg-reconfigure -fnoninteractive --no-reload xserver-xorg

	if [ -e /target/etc/X11/xorg.conf.orig ]; then
		mv /target/etc/X11/xorg.conf.orig /target/etc/X11/xorg.conf
	fi
fi

