#! /bin/sh

# Dummy xkbcomp:
# Symlinks the pathname provided in the final argument to a precompiled default
# xkm, and then exits normally to indicate a "successful compilation".  A
# symlink is required because the X server assumes that this file is temporary,
# and deletes it upon exit.

TEMPLATE_DIR='/etc/X11/xkb/precompiled'

OUTPUT_XKM="`echo $* | awk '{print $NF}'`"
XKM_NAME="`basename $OUTPUT_XKM`"
XKM_DIR="`dirname $OUTPUT_XKM`"		# in practice this will always be
					# /usr/lib/X11/xkb/compiled

if [ -f "$TEMPLATE_DIR/$XKM_NAME" -a -w "$XKM_DIR" ]; then
    ln -s "$TEMPLATE_DIR/$XKM_NAME" "$OUTPUT_XKM"
    exit 0
else
    echo "Precompiled keymap $XKM_NAME not found!" 1>&2
    exit 1
fi
