#!/bin/bash

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/slapt-get/slapt-getrc.new
slapt-get -u
CWD=$(pwd)
cd usr/info
if [ -f dir ];then
    rm dir
fi
if [ -f dir.gz ];then
    rm dir.gz
fi
for i in *.info.gz;do
    install-info $i dir
done
cd $CWD

( cd usr/lib ; rm -rf libslapt.so )
( cd usr/lib ; ln -sf libslapt.so.0.10.2t libslapt.so )
