#!/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...
}

sed -i "s/yourhostname/$(cat etc/HOSTNAME)/" etc/NetworkManager/NetworkManager.conf.new

## List of conf files to check.  The conf files in your package should end in .new
config ./etc/NetworkManager/NetworkManager.conf.new
config ./etc/rc.d/init.d/networkmanager.new
config ./etc/rc.d/rc.networkmanager.new


( cd usr/lib ; rm -rf libnm-glib.so.4 )
( cd usr/lib ; ln -sf libnm-glib.so.4.9.0 libnm-glib.so.4 )
( cd usr/lib ; rm -rf libnm-util.so.2 )
( cd usr/lib ; ln -sf libnm-util.so.2.7.0 libnm-util.so.2 )
( cd usr/lib ; rm -rf libnm.so.0 )
( cd usr/lib ; ln -sf libnm.so.0.0.0 libnm.so.0 )
( cd usr/lib ; rm -rf libnm-glib.so )
( cd usr/lib ; ln -sf libnm-glib.so.4.9.0 libnm-glib.so )
( cd usr/lib ; rm -rf libnm-glib-vpn.so.1 )
( cd usr/lib ; ln -sf libnm-glib-vpn.so.1.2.0 libnm-glib-vpn.so.1 )
( cd usr/lib ; rm -rf libnm-util.so )
( cd usr/lib ; ln -sf libnm-util.so.2.7.0 libnm-util.so )
( cd usr/lib ; rm -rf libnm.so )
( cd usr/lib ; ln -sf libnm.so.0.0.0 libnm.so )
( cd usr/lib ; rm -rf libnm-glib-vpn.so )
( cd usr/lib ; ln -sf libnm-glib-vpn.so.1.2.0 libnm-glib-vpn.so )
