config() {
  NEW="$1"
  OLD="$(dirname $NEW)/$(basename $NEW .new)"
  if [ ! -r $OLD ]; then
    mv $NEW $OLD
  elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then 
    rm $NEW
  fi
}

if [ ! -d /var/run/lirc ] ; then
    mkdir /var/run/lirc
fi

config etc/lirc/lircd.conf.new
config etc/lircmd.conf.new
config etc/lircrc.new
config etc/logrotate.d/lirc.new
config etc/rc.d/rc.lirc.new

if [ -x sbin/depmod ]; then
  chroot . /sbin/depmod -ae 3.10.17-smp 1> /dev/null 2> /dev/null
fi
( cd usr/lib ; rm -rf liblirc_client.so )
( cd usr/lib ; ln -sf liblirc_client.so.0.2.1 liblirc_client.so )
( cd usr/lib ; rm -rf liblirc_client.so.0 )
( cd usr/lib ; ln -sf liblirc_client.so.0.2.1 liblirc_client.so.0 )
