#!/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/lib64/distcc ; rm -rf c++ )
( cd usr/lib64/distcc ; ln -sf ../../bin/distcc c++ )
( cd usr/lib64/distcc ; rm -rf c89 )
( cd usr/lib64/distcc ; ln -sf ../../bin/distcc c89 )
( cd usr/lib64/distcc ; rm -rf c99 )
( cd usr/lib64/distcc ; ln -sf ../../bin/distcc c99 )
( cd usr/lib64/distcc ; rm -rf cc )
( cd usr/lib64/distcc ; ln -sf ../../bin/distcc cc )
( cd usr/lib64/distcc ; rm -rf clang )
( cd usr/lib64/distcc ; ln -sf ../../bin/distcc clang )
( cd usr/lib64/distcc ; rm -rf clang++ )
( cd usr/lib64/distcc ; ln -sf ../../bin/distcc clang++ )
( cd usr/lib64/distcc ; rm -rf g++ )
( cd usr/lib64/distcc ; ln -sf ../../bin/distcc g++ )
( cd usr/lib64/distcc ; rm -rf gcc )
( cd usr/lib64/distcc ; ln -sf ../../bin/distcc gcc )
( cd usr/lib64/distcc ; rm -rf gcc-8.2.0 )
( cd usr/lib64/distcc ; ln -sf ../../bin/distcc gcc-8.2.0 )
( cd usr/lib64/distcc ; rm -rf x86_64-slackware-linux-g++ )
( cd usr/lib64/distcc ; ln -sf ../../bin/distcc x86_64-slackware-linux-g++ )
( cd usr/lib64/distcc ; rm -rf x86_64-slackware-linux-gcc )
( cd usr/lib64/distcc ; ln -sf ../../bin/distcc x86_64-slackware-linux-gcc )
( cd usr/lib64/distcc ; rm -rf x86_64-slackware-linux-gcc-8.2.0 )
( cd usr/lib64/distcc ; ln -sf ../../bin/distcc x86_64-slackware-linux-gcc-8.2.0 )
( cd usr/share/applications ; rm -rf distccmon-gnome.desktop )
( cd usr/share/applications ; ln -sf /usr/share/distcc/distccmon-gnome.desktop distccmon-gnome.desktop )
