#!/bin/sh
ulimit -s unlimited
shopt -s extglob
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/X11/seyon/Seyon-modem.new
config etc/X11/app-defaults/Seyon.new
config etc/X11/app-defaults/Seyon-color.new

( cd usr/doc/seyon-2.20c ; rm -rf HOME.seyon.directory.example )
( cd usr/doc/seyon-2.20c ; ln -sf .seyon HOME.seyon.directory.example )
( cd usr/lib64/X11 ; rm -rf app-defaults )
( cd usr/lib64/X11 ; ln -sf ../../../etc/X11/app-defaults app-defaults )
