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...
}

if [ -x /usr/bin/update-desktop-database ]; then
  /usr/bin/update-desktop-database usr/share/applications >/dev/null 2>&1
fi

if [ -x /usr/bin/update-mime-database ]; then
  /usr/bin/update-mime-database usr/share/mime >/dev/null 2>&1
fi

if [ -x /usr/bin/gtk-update-icon-cache ] \
  && [ -e usr/share/icons/hicolor/icon-theme.cache ]; then
  /usr/bin/gtk-update-icon-cache -f usr/share/icons/hicolor >/dev/null 2>&1
fi

config etc/ardour8/./ardour.keys.new
config etc/ardour8/./default_ui_config.new
config etc/ardour8/./system_config.new
config etc/ardour8/./clearlooks.ardoursans.rc.new
config etc/ardour8/./ardour.menus.new
config etc/ardour8/./clearlooks.rc.new
( cd usr/bin ; rm -rf ardour8-copy-mixer )
( cd usr/bin ; ln -sf /usr/lib64/ardour8/utils/ardour-util.sh ardour8-copy-mixer )
( cd usr/bin ; rm -rf ardour8-export )
( cd usr/bin ; ln -sf /usr/lib64/ardour8/utils/ardour-util.sh ardour8-export )
( cd usr/bin ; rm -rf ardour8-new_empty_session )
( cd usr/bin ; ln -sf /usr/lib64/ardour8/utils/ardour-util.sh ardour8-new_empty_session )
( cd usr/bin ; rm -rf ardour8-new_session )
( cd usr/bin ; ln -sf /usr/lib64/ardour8/utils/ardour-util.sh ardour8-new_session )
( cd usr/lib64/ardour8 ; rm -rf libaaf.so )
( cd usr/lib64/ardour8 ; ln -sf libaaf.so.0.0.0 libaaf.so )
( cd usr/lib64/ardour8 ; rm -rf libaaf.so.0 )
( cd usr/lib64/ardour8 ; ln -sf libaaf.so.0.0.0 libaaf.so.0 )
( cd usr/lib64/ardour8 ; rm -rf libardour.so )
( cd usr/lib64/ardour8 ; ln -sf libardour.so.3.0.0 libardour.so )
( cd usr/lib64/ardour8 ; rm -rf libardour.so.3 )
( cd usr/lib64/ardour8 ; ln -sf libardour.so.3.0.0 libardour.so.3 )
( cd usr/lib64/ardour8 ; rm -rf libardouralsautil.so )
( cd usr/lib64/ardour8 ; ln -sf libardouralsautil.so.0.0.1 libardouralsautil.so )
( cd usr/lib64/ardour8 ; rm -rf libardouralsautil.so.0 )
( cd usr/lib64/ardour8 ; ln -sf libardouralsautil.so.0.0.1 libardouralsautil.so.0 )
( cd usr/lib64/ardour8 ; rm -rf libaudiographer.so )
( cd usr/lib64/ardour8 ; ln -sf libaudiographer.so.0.0.0 libaudiographer.so )
( cd usr/lib64/ardour8 ; rm -rf libaudiographer.so.0 )
( cd usr/lib64/ardour8 ; ln -sf libaudiographer.so.0.0.0 libaudiographer.so.0 )
( cd usr/lib64/ardour8 ; rm -rf libcanvas.so )
( cd usr/lib64/ardour8 ; ln -sf libcanvas.so.0.0.0 libcanvas.so )
( cd usr/lib64/ardour8 ; rm -rf libcanvas.so.0 )
( cd usr/lib64/ardour8 ; ln -sf libcanvas.so.0.0.0 libcanvas.so.0 )
( cd usr/lib64/ardour8 ; rm -rf libevoral.so )
( cd usr/lib64/ardour8 ; ln -sf libevoral.so.0.0.0 libevoral.so )
( cd usr/lib64/ardour8 ; rm -rf libevoral.so.0 )
( cd usr/lib64/ardour8 ; ln -sf libevoral.so.0.0.0 libevoral.so.0 )
( cd usr/lib64/ardour8 ; rm -rf libgtkmm2ext.so )
( cd usr/lib64/ardour8 ; ln -sf libgtkmm2ext.so.0.8.3 libgtkmm2ext.so )
( cd usr/lib64/ardour8 ; rm -rf libgtkmm2ext.so.0 )
( cd usr/lib64/ardour8 ; ln -sf libgtkmm2ext.so.0.8.3 libgtkmm2ext.so.0 )
( cd usr/lib64/ardour8 ; rm -rf libmidipp.so )
( cd usr/lib64/ardour8 ; ln -sf libmidipp.so.4.1.0 libmidipp.so )
( cd usr/lib64/ardour8 ; rm -rf libmidipp.so.4 )
( cd usr/lib64/ardour8 ; ln -sf libmidipp.so.4.1.0 libmidipp.so.4 )
( cd usr/lib64/ardour8 ; rm -rf libpbd.so )
( cd usr/lib64/ardour8 ; ln -sf libpbd.so.4.1.0 libpbd.so )
( cd usr/lib64/ardour8 ; rm -rf libpbd.so.4 )
( cd usr/lib64/ardour8 ; ln -sf libpbd.so.4.1.0 libpbd.so.4 )
( cd usr/lib64/ardour8 ; rm -rf libptformat.so )
( cd usr/lib64/ardour8 ; ln -sf libptformat.so.0.0.0 libptformat.so )
( cd usr/lib64/ardour8 ; rm -rf libptformat.so.0 )
( cd usr/lib64/ardour8 ; ln -sf libptformat.so.0.0.0 libptformat.so.0 )
( cd usr/lib64/ardour8 ; rm -rf libsuil.so )
( cd usr/lib64/ardour8 ; ln -sf libsuil.so.0.10.8 libsuil.so )
( cd usr/lib64/ardour8 ; rm -rf libsuil.so.0 )
( cd usr/lib64/ardour8 ; ln -sf libsuil.so.0.10.8 libsuil.so.0 )
( cd usr/lib64/ardour8 ; rm -rf libtemporal.so )
( cd usr/lib64/ardour8 ; ln -sf libtemporal.so.0.0.0 libtemporal.so )
( cd usr/lib64/ardour8 ; rm -rf libtemporal.so.0 )
( cd usr/lib64/ardour8 ; ln -sf libtemporal.so.0.0.0 libtemporal.so.0 )
( cd usr/lib64/ardour8 ; rm -rf libwaveview.so )
( cd usr/lib64/ardour8 ; ln -sf libwaveview.so.0.0.0 libwaveview.so )
( cd usr/lib64/ardour8 ; rm -rf libwaveview.so.0 )
( cd usr/lib64/ardour8 ; ln -sf libwaveview.so.0.0.0 libwaveview.so.0 )
( cd usr/lib64/ardour8 ; rm -rf libwidgets.so )
( cd usr/lib64/ardour8 ; ln -sf libwidgets.so.0.0.0 libwidgets.so )
( cd usr/lib64/ardour8 ; rm -rf libwidgets.so.0 )
( cd usr/lib64/ardour8 ; ln -sf libwidgets.so.0.0.0 libwidgets.so.0 )
( cd usr/lib64/ardour8 ; rm -rf libydk-pixbuf.so )
( cd usr/lib64/ardour8 ; ln -sf libydk-pixbuf.so.2.31.1 libydk-pixbuf.so )
( cd usr/lib64/ardour8 ; rm -rf libydk-pixbuf.so.2 )
( cd usr/lib64/ardour8 ; ln -sf libydk-pixbuf.so.2.31.1 libydk-pixbuf.so.2 )
( cd usr/lib64/ardour8 ; rm -rf libydk.so )
( cd usr/lib64/ardour8 ; ln -sf libydk.so.2.24.23 libydk.so )
( cd usr/lib64/ardour8 ; rm -rf libydk.so.2 )
( cd usr/lib64/ardour8 ; ln -sf libydk.so.2.24.23 libydk.so.2 )
( cd usr/lib64/ardour8 ; rm -rf libydkmm.so )
( cd usr/lib64/ardour8 ; ln -sf libydkmm.so.2.24.5 libydkmm.so )
( cd usr/lib64/ardour8 ; rm -rf libydkmm.so.2 )
( cd usr/lib64/ardour8 ; ln -sf libydkmm.so.2.24.5 libydkmm.so.2 )
( cd usr/lib64/ardour8 ; rm -rf libytk.so )
( cd usr/lib64/ardour8 ; ln -sf libytk.so.2.24.23 libytk.so )
( cd usr/lib64/ardour8 ; rm -rf libytk.so.2 )
( cd usr/lib64/ardour8 ; ln -sf libytk.so.2.24.23 libytk.so.2 )
( cd usr/lib64/ardour8 ; rm -rf libytkmm.so )
( cd usr/lib64/ardour8 ; ln -sf libytkmm.so.2.24.5 libytkmm.so )
( cd usr/lib64/ardour8 ; rm -rf libytkmm.so.2 )
( cd usr/lib64/ardour8 ; ln -sf libytkmm.so.2.24.5 libytkmm.so.2 )
( cd usr/lib64/ardour8 ; rm -rf libztk.so )
( cd usr/lib64/ardour8 ; ln -sf libztk.so.2.14.0 libztk.so )
( cd usr/lib64/ardour8 ; rm -rf libztk.so.2 )
( cd usr/lib64/ardour8 ; ln -sf libztk.so.2.14.0 libztk.so.2 )
( cd usr/lib64/ardour8 ; rm -rf libztkmm.so )
( cd usr/lib64/ardour8 ; ln -sf libztkmm.so.2.22.7 libztkmm.so )
( cd usr/lib64/ardour8 ; rm -rf libztkmm.so.2 )
( cd usr/lib64/ardour8 ; ln -sf libztkmm.so.2.22.7 libztkmm.so.2 )
( cd usr/lib64/ardour8/vamp ; rm -rf libardourvamppyin.so )
( cd usr/lib64/ardour8/vamp ; ln -sf libardourvamppyin.so.0.0.0 libardourvamppyin.so )
( cd usr/lib64/ardour8/vamp ; rm -rf libardourvamppyin.so.0 )
( cd usr/lib64/ardour8/vamp ; ln -sf libardourvamppyin.so.0.0.0 libardourvamppyin.so.0 )
