( cd usr/share/icons/hicolor/16x16/apps ; rm -rf org.armagetronad.armagetronad.png )
( cd usr/share/icons/hicolor/16x16/apps ; ln -sf ../../../../games/armagetronad/desktop/icons/16x16/armagetronad.png org.armagetronad.armagetronad.png )
( cd usr/share/icons/hicolor/32x32/apps ; rm -rf org.armagetronad.armagetronad.png )
( cd usr/share/icons/hicolor/32x32/apps ; ln -sf ../../../../games/armagetronad/desktop/icons/32x32/armagetronad.png org.armagetronad.armagetronad.png )
( cd usr/share/icons/hicolor/48x48/apps ; rm -rf org.armagetronad.armagetronad.png )
( cd usr/share/icons/hicolor/48x48/apps ; ln -sf ../../../../games/armagetronad/desktop/icons/48x48/armagetronad.png org.armagetronad.armagetronad.png )

config() {
  NEW="$1"
  OLD="$(dirname $NEW)/$(basename $NEW .new)"
  if [ ! -r $OLD ]; then
    mv $NEW $OLD
  elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
    rm $NEW
  fi
}

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

if [ -e usr/share/icons/hicolor/icon-theme.cache ]; then
  if [ -x /usr/bin/gtk-update-icon-cache ]; then
    /usr/bin/gtk-update-icon-cache usr/share/icons/hicolor >/dev/null 2>&1
  fi
fi
config etc/armagetronad/aiplayers.cfg.new
config etc/armagetronad/default.cfg.new
config etc/armagetronad/keys_cursor.cfg.new
config etc/armagetronad/keys_cursor_single.cfg.new
config etc/armagetronad/keys_twohand.cfg.new
config etc/armagetronad/keys_wasd.cfg.new
config etc/armagetronad/keys_x.cfg.new
config etc/armagetronad/keys_zqsd.cfg.new
config etc/armagetronad/settings.cfg.new
config etc/armagetronad/settings_authentication.cfg.new
config etc/armagetronad/settings_dedicated.cfg.new
config etc/armagetronad/settings_visual.cfg.new
