#!/bin/sh

set -e

rm -f /etc/init.d/lirc

if [ -x /bin/systemd-tmpfiles ]; then
    /bin/systemd-tmpfiles --create /usr/lib/tmpfiles.d/lirc.conf || :
fi

for f in lircd.conf lircmd.conf irexec.lircrc lirc_options.conf; do
    test -e /etc/lirc/$f || cp /etc/lirc/${f}.dist /etc/lirc/$f || :
done

# distutils' sysconfig.get_python_lib is broken - #911038. Furthermore, the
# first iteration of this fix did not remove the links in postrm. So:
find /usr/lib/python3/dist-packages -maxdepth 1 -type l -name lirc -delete
find /usr/lib/python3/dist-packages -maxdepth 1 -type l -name lirc-setup -delete
ln -s /usr/lib/*/python*/site-packages/lirc \
    /usr/lib/python3/dist-packages
ln -s /usr/lib/*/python*/site-packages/lirc-setup \
    /usr/lib/python3/dist-packages

#DEBHELPER#
