#!/bin/sh
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...
}
config etc/distcc/clients.allow.new
config etc/distcc/commands.allow.sh.new
config etc/distcc/hosts.new
( cd usr/lib/distcc ; rm -rf aarch64-slackware-linux-gnu-g++ )
( cd usr/lib/distcc ; ln -sf ../../bin/distcc aarch64-slackware-linux-gnu-g++ )
( cd usr/lib/distcc ; rm -rf aarch64-slackware-linux-gnu-gcc )
( cd usr/lib/distcc ; ln -sf ../../bin/distcc aarch64-slackware-linux-gnu-gcc )
( cd usr/lib/distcc ; rm -rf c++ )
( cd usr/lib/distcc ; ln -sf ../../bin/distcc c++ )
( cd usr/lib/distcc ; rm -rf c89 )
( cd usr/lib/distcc ; ln -sf ../../bin/distcc c89 )
( cd usr/lib/distcc ; rm -rf c99 )
( cd usr/lib/distcc ; ln -sf ../../bin/distcc c99 )
( cd usr/lib/distcc ; rm -rf cc )
( cd usr/lib/distcc ; ln -sf ../../bin/distcc cc )
( cd usr/lib/distcc ; rm -rf clang )
( cd usr/lib/distcc ; ln -sf ../../bin/distcc clang )
( cd usr/lib/distcc ; rm -rf clang++ )
( cd usr/lib/distcc ; ln -sf ../../bin/distcc clang++ )
( cd usr/lib/distcc ; rm -rf g++ )
( cd usr/lib/distcc ; ln -sf ../../bin/distcc g++ )
( cd usr/lib/distcc ; rm -rf gcc )
( cd usr/lib/distcc ; ln -sf ../../bin/distcc gcc )
( cd usr/lib/distcc ; rm -rf gcc-14.2.0 )
( cd usr/lib/distcc ; ln -sf ../../bin/distcc gcc-14.2.0 )
( cd usr/lib64 ; rm -rf distcc )
( cd usr/lib64 ; ln -sf ../lib/distcc distcc )
