#! /bin/sh

# postinst - script to finish installation of the 'kbd'-package.
# (c) 1997, 1998  Yann Dirson
# (c) 1996  Dominik Kubla

### rcS.d links

DEFAULT_PRIORITY=05
LINK_NAME=keymaps.sh
OLDLINK_NAME=keymaps
LINK_DIR=/etc/rcS.d

# remove any (hamm unstable) old buggy link name with '?' chars inside
if [ -L ${LINK_DIR}/S\?\?${LINK_NAME} ]; then
    echo >&2 "Removing old buggy link: " \
	$(rm -fv ${LINK_DIR}/S\?\?${LINK_NAME}) .
fi

# remove any (hamm unstable) obsolete links for /etc/rcS.d/S??keymaps{,.sh}
if [ -L ${LINK_DIR}/S??${OLDLINK_NAME} ]; then
    echo >&2 "Removing obsolete link: " \
	$(rm -fv ${LINK_DIR}/S??${OLDLINK_NAME}) .
fi
if [ -L ${LINK_DIR}/S??${LINK_NAME} -a \
	! ${LINK_DIR}/S??${LINK_NAME} -ef /etc/init.d/${LINK_NAME} ]; then
    echo >&2 "Removing obsolete link: " \
	$(rm -fv ${LINK_DIR}/S??${LINK_NAME}) .
fi

# remove any (hamm unstable) obsolete init.d scripts
if [ -r /etc/init.d/${OLDLINK_NAME} -o -r /etc/init.d/kbd-boot.sh ]
then
    echo "Removing any obsolete scripts:" \
	$(rm -fv /etc/init.d/${OLDLINK_NAME} /etc/init.d/kbd-boot.sh)"."
fi

### default keymap

# compress any uncompressed default kmap
if [ -r /etc/kbd/default.map ]; then
    gzip -9 /etc/kbd/default.map
fi

if [ ! -r /etc/kbd/default.map -a ! -r /etc/kbd/default.map.gz ]; then
    echo "  You now use the default keyboard layout of the kernel."
    echo "   (unless you changed it manually)"
    echo
    echo "  You may want it to match your actual keyboard (which is most likely"
    echo "   for non-american keyboards); just press RETURN to the following"
    echo "   prompt if you're happy with the defaults."
    echo "  You'll be able to change it again at any time by running"
    echo "   /usr/sbin/kbdconfig."
    
    /usr/sbin/kbdconfig
fi

# Automatically added by dh_installinit
update-rc.d keymaps.sh start 05 S . >/dev/null
# End automatically added section

