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...
}
for file in etc/cups/*.new ; do
  config $file
done

if [ -r etc/pam.d/cups.new ]; then
  config etc/pam.d/cups.new
fi

# Leave any new rc.cups with the same permissions as the old one:
# This is a kludge, but it's because there's no --reference option
# on busybox's 'chmod':
if [ -e etc/rc.d/rc.cups ]; then
  if [ -x etc/rc.d/rc.cups ]; then
    chmod 755 etc/rc.d/rc.cups.new
  else
    chmod 644 etc/rc.d/rc.cups.new
  fi
fi
# Then config() it:
config etc/rc.d/rc.cups.new
( cd usr/doc ; rm -rf cups )
( cd usr/doc ; ln -sf cups-2.4.2 cups )
( cd usr/lib/cups/backend ; rm -rf http )
( cd usr/lib/cups/backend ; ln -sf ipp http )
( cd usr/lib/cups/backend ; rm -rf https )
( cd usr/lib/cups/backend ; ln -sf ipp https )
( cd usr/lib/cups/backend ; rm -rf ipps )
( cd usr/lib/cups/backend ; ln -sf ipp ipps )
( cd usr/lib/cups/backend ; rm -rf smb )
( cd usr/lib/cups/backend ; ln -sf /usr/bin/smbspool smb )
( cd usr/lib ; rm -rf libcups.so )
( cd usr/lib ; ln -sf libcups.so.2 libcups.so )
( cd usr/lib ; rm -rf libcupsimage.so )
( cd usr/lib ; ln -sf libcupsimage.so.2 libcupsimage.so )
( cd usr/man/man7 ; rm -rf ippeveps.7.gz )
( cd usr/man/man7 ; ln -sf ippevepcl.7.gz ippeveps.7.gz )
( cd usr/man/man8 ; rm -rf cups-deviced.8.gz )
( cd usr/man/man8 ; ln -sf cupsd-helper.8.gz cups-deviced.8.gz )
( cd usr/man/man8 ; rm -rf cups-driverd.8.gz )
( cd usr/man/man8 ; ln -sf cupsd-helper.8.gz cups-driverd.8.gz )
( cd usr/man/man8 ; rm -rf cups-exec.8.gz )
( cd usr/man/man8 ; ln -sf cupsd-helper.8.gz cups-exec.8.gz )
( cd usr/man/man8 ; rm -rf cupsdisable.8.gz )
( cd usr/man/man8 ; ln -sf cupsenable.8.gz cupsdisable.8.gz )
( cd usr/man/man8 ; rm -rf cupsreject.8.gz )
( cd usr/man/man8 ; ln -sf cupsaccept.8.gz cupsreject.8.gz )
( cd usr/sbin ; rm -rf cupsdisable )
( cd usr/sbin ; ln -sf cupsaccept cupsdisable )
( cd usr/sbin ; rm -rf cupsenable )
( cd usr/sbin ; ln -sf cupsaccept cupsenable )
( cd usr/sbin ; rm -rf cupsreject )
( cd usr/sbin ; ln -sf cupsaccept cupsreject )
