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
}

config etc/lircd.conf.new
config etc/lircmd.conf.new
config etc/lircrc.new
config etc/logrotate.d/lirc.new
( cd usr/bin ; rm -rf lirc-setup )
( cd usr/bin ; ln -sf ../lib/python3.9/site-packages/lirc/lirc-setup lirc-setup )
( cd usr/doc/lirc-0.9.3a/html ; rm -rf api-docs )
( cd usr/doc/lirc-0.9.3a/html ; ln -sf lirc.org/api-docs/html/index.html api-docs )
( cd usr/doc/lirc-0.9.3a/html ; rm -rf images )
( cd usr/doc/lirc-0.9.3a/html ; ln -sf ../images images )
( cd usr/doc/lirc-0.9.3a/html ; rm -rf lirc.org )
( cd usr/doc/lirc-0.9.3a/html ; ln -sf ../lirc.org lirc.org )
( cd usr/doc/lirc-0.9.3a/lirc.org/html ; rm -rf api-docs )
( cd usr/doc/lirc-0.9.3a/lirc.org/html ; ln -sf ../api-docs/html/index.html api-docs )
( cd usr/doc/lirc-0.9.3a/lirc.org/html ; rm -rf lirc.org )
( cd usr/doc/lirc-0.9.3a/lirc.org/html ; ln -sf .. lirc.org )
( cd usr/lib ; rm -rf libirrecord.so )
( cd usr/lib ; ln -sf libirrecord.so.0.0.0 libirrecord.so )
( cd usr/lib ; rm -rf libirrecord.so.0 )
( cd usr/lib ; ln -sf libirrecord.so.0.0.0 libirrecord.so.0 )
( cd usr/lib ; rm -rf liblirc.so )
( cd usr/lib ; ln -sf liblirc.so.0.0.0 liblirc.so )
( cd usr/lib ; rm -rf liblirc.so.0 )
( cd usr/lib ; ln -sf liblirc.so.0.0.0 liblirc.so.0 )
( cd usr/lib ; rm -rf liblirc_client.so )
( cd usr/lib ; ln -sf liblirc_client.so.0.3.0 liblirc_client.so )
( cd usr/lib ; rm -rf liblirc_client.so.0 )
( cd usr/lib ; ln -sf liblirc_client.so.0.3.0 liblirc_client.so.0 )
( cd usr/lib ; rm -rf liblirc_driver.so )
( cd usr/lib ; ln -sf liblirc_driver.so.0.0.0 liblirc_driver.so )
( cd usr/lib ; rm -rf liblirc_driver.so.0 )
( cd usr/lib ; ln -sf liblirc_driver.so.0.0.0 liblirc_driver.so.0 )
( cd usr/lib/python3.9/site-packages/lirc ; rm -rf configs )
( cd usr/lib/python3.9/site-packages/lirc ; ln -sf ../../../../share/lirc/configs configs )
