#!/bin/sh
set -e

OLDCONFFILES="alcovebook/html/gtk alcovebook/print/article alcovebook/print/nwalsh docbook/print/bookarticle alcovebook/html/ldp alcovebook/print/bookarticle alcovebook/html/nwalsh alcovebook/print/ldp docbook/print/article"

OLDCONFDIR=/etc/sgml/sgml2x
NEWCONFDIR=/etc/sgml/sgml2x/styles

# move conffiles from old location to new

for i in ${OLDCONFFILES}
do
    if [ -r ${OLDCONFDIR}/$i ]
    then
	if [ -r ${NEWCONFDIR}/$i ]
	then
	    echo >&2 "WARNING: old sgml2x conffile ${OLDCONFDIR}/$i not moved to ${NEWCONFDIR}/$i"
	    echo >&2 "  because there is a new file in that location.  Please fix by hand."
	else
	    printf >&2 "Note: moving old sgml2x conffile: "
	    mkdir -p `dirname ${NEWCONFDIR}/$i`
	    mv --verbose ${OLDCONFDIR}/$i ${NEWCONFDIR}/$i
	fi
    fi
done

# remove empty old confdirs if any
rmdir -p ${OLDCONFDIR}/*/* 2> /dev/null || true

#DEBHELPER#
