#!/bin/sh
# Figure out our root directory
ROOTDIR=$(pwd)
unset CHROOT
if test "${ROOTDIR}" != "/"; then
  CHROOT="chroot ${ROOTDIR} "
  ROOTDIR="${ROOTDIR}/"
fi
if [ -x usr/bin/update-desktop-database ]; then
  ${CHROOT} /usr/bin/update-desktop-database 1> /dev/null 2> /dev/null
fi
config() {
  NEW="$1"
  OLD="$(dirname $NEW)/$(basename $NEW .new)"
  # If there's no config file by that name, mv it over:
  if [ ! -r $OLD ]; then
    mv $NEW $OLD
  elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
    # toss the redundant copy
    rm $NEW
  fi
  # Otherwise, we leave the .new copy for the admin to consider...
## List of conf files to check.  The conf files in your package should end in .new
}
config etc/hp/hplip.conf.new


( cd usr/bin ; rm -rf hp-systray )
( cd usr/bin ; ln -sf ../share/hplip/systray.py hp-systray )
( cd usr/bin ; rm -rf hp-makeuri )
( cd usr/bin ; ln -sf ../share/hplip/makeuri.py hp-makeuri )
( cd usr/bin ; rm -rf hp-info )
( cd usr/bin ; ln -sf ../share/hplip/info.py hp-info )
( cd usr/bin ; rm -rf hp-testpage )
( cd usr/bin ; ln -sf ../share/hplip/testpage.py hp-testpage )
( cd usr/bin ; rm -rf hp-probe )
( cd usr/bin ; ln -sf ../share/hplip/probe.py hp-probe )
( cd usr/bin ; rm -rf hp-devicesettings )
( cd usr/bin ; ln -sf ../share/hplip/devicesettings.py hp-devicesettings )
( cd usr/bin ; rm -rf hp-printsettings )
( cd usr/bin ; ln -sf ../share/hplip/printsettings.py hp-printsettings )
( cd usr/bin ; rm -rf hp-unload )
( cd usr/bin ; ln -sf ../share/hplip/unload.py hp-unload )
( cd usr/bin ; rm -rf hp-firmware )
( cd usr/bin ; ln -sf ../share/hplip/firmware.py hp-firmware )
( cd usr/bin ; rm -rf hp-pkservice )
( cd usr/bin ; ln -sf ../share/hplip/pkservice.py hp-pkservice )
( cd usr/bin ; rm -rf hp-timedate )
( cd usr/bin ; ln -sf ../share/hplip/timedate.py hp-timedate )
( cd usr/bin ; rm -rf hp-colorcal )
( cd usr/bin ; ln -sf ../share/hplip/colorcal.py hp-colorcal )
( cd usr/bin ; rm -rf hp-check )
( cd usr/bin ; ln -sf ../share/hplip/check.py hp-check )
( cd usr/bin ; rm -rf hp-query )
( cd usr/bin ; ln -sf ../share/hplip/query.py hp-query )
( cd usr/bin ; rm -rf hp-faxsetup )
( cd usr/bin ; ln -sf ../share/hplip/faxsetup.py hp-faxsetup )
( cd usr/bin ; rm -rf hp-wificonfig )
( cd usr/bin ; ln -sf ../share/hplip/wificonfig.py hp-wificonfig )
( cd usr/bin ; rm -rf hp-print )
( cd usr/bin ; ln -sf ../share/hplip/print.py hp-print )
( cd usr/bin ; rm -rf hp-scan )
( cd usr/bin ; ln -sf ../share/hplip/scan.py hp-scan )
( cd usr/bin ; rm -rf hp-align )
( cd usr/bin ; ln -sf ../share/hplip/align.py hp-align )
( cd usr/bin ; rm -rf hp-setup )
( cd usr/bin ; ln -sf ../share/hplip/setup.py hp-setup )
( cd usr/bin ; rm -rf hp-sendfax )
( cd usr/bin ; ln -sf ../share/hplip/sendfax.py hp-sendfax )
( cd usr/bin ; rm -rf hp-fab )
( cd usr/bin ; ln -sf ../share/hplip/fab.py hp-fab )
( cd usr/bin ; rm -rf hp-clean )
( cd usr/bin ; ln -sf ../share/hplip/clean.py hp-clean )
( cd usr/bin ; rm -rf hp-levels )
( cd usr/bin ; ln -sf ../share/hplip/levels.py hp-levels )
( cd usr/bin ; rm -rf hp-makecopies )
( cd usr/bin ; ln -sf ../share/hplip/makecopies.py hp-makecopies )
( cd usr/bin ; rm -rf hp-plugin )
( cd usr/bin ; ln -sf ../share/hplip/plugin.py hp-plugin )
( cd usr/bin ; rm -rf hp-toolbox )
( cd usr/bin ; ln -sf ../share/hplip/toolbox.py hp-toolbox )
( cd usr/bin ; rm -rf hp-pqdiag )
( cd usr/bin ; ln -sf ../share/hplip/pqdiag.py hp-pqdiag )
( cd usr/bin ; rm -rf hp-linefeedcal )
( cd usr/bin ; ln -sf ../share/hplip/linefeedcal.py hp-linefeedcal )
( cd usr/lib ; rm -rf libhpmud.so )
( cd usr/lib ; ln -sf libhpmud.so.0.0.6 libhpmud.so )
( cd usr/lib ; rm -rf libhpip.so )
( cd usr/lib ; ln -sf libhpip.so.0.0.1 libhpip.so )
( cd usr/lib ; rm -rf libhpip.so.0 )
( cd usr/lib ; ln -sf libhpip.so.0.0.1 libhpip.so.0 )
( cd usr/lib ; rm -rf libhpmud.so.0 )
( cd usr/lib ; ln -sf libhpmud.so.0.0.6 libhpmud.so.0 )
( cd usr/lib/sane ; rm -rf libsane-hpaio.so.1 )
( cd usr/lib/sane ; ln -sf libsane-hpaio.so.1.0.0 libsane-hpaio.so.1 )
( cd usr/lib/sane ; rm -rf libsane-hpaio.so )
( cd usr/lib/sane ; ln -sf libsane-hpaio.so.1.0.0 libsane-hpaio.so )
