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...
}
preserve_perms() {
  NEW="$1"
  OLD="$(dirname ${NEW})/$(basename ${NEW} .new)"
  if [ -e ${OLD} ]; then
    cp -a ${OLD} ${NEW}.incoming
    cat ${NEW} > ${NEW}.incoming
    mv ${NEW}.incoming ${NEW}
  fi
  config ${NEW}
}
( cd usr/bin/32 ; rm -rf mariabackup )
( cd usr/bin/32 ; ln -sf mariadb-backup mariabackup )
( cd usr/bin/32 ; rm -rf mariadb-config )
( cd usr/bin/32 ; ln -sf mariadb_config mariadb-config )
( cd usr/bin/32 ; rm -rf mysql )
( cd usr/bin/32 ; ln -sf mariadb mysql )
( cd usr/bin/32 ; rm -rf mysql_client_test )
( cd usr/bin/32 ; ln -sf mariadb-client-test mysql_client_test )
( cd usr/bin/32 ; rm -rf mysql_client_test_embedded )
( cd usr/bin/32 ; ln -sf mariadb-client-test-embedded mysql_client_test_embedded )
( cd usr/bin/32 ; rm -rf mysql_convert_table_format )
( cd usr/bin/32 ; ln -sf mariadb-convert-table-format mysql_convert_table_format )
( cd usr/bin/32 ; rm -rf mysql_embedded )
( cd usr/bin/32 ; ln -sf mariadb-embedded mysql_embedded )
( cd usr/bin/32 ; rm -rf mysql_find_rows )
( cd usr/bin/32 ; ln -sf mariadb-find-rows mysql_find_rows )
( cd usr/bin/32 ; rm -rf mysql_fix_extensions )
( cd usr/bin/32 ; ln -sf mariadb-fix-extensions mysql_fix_extensions )
( cd usr/bin/32 ; rm -rf mysql_install_db )
( cd usr/bin/32 ; ln -sf mariadb-install-db mysql_install_db )
( cd usr/bin/32 ; rm -rf mysql_plugin )
( cd usr/bin/32 ; ln -sf mariadb-plugin mysql_plugin )
( cd usr/bin/32 ; rm -rf mysql_secure_installation )
( cd usr/bin/32 ; ln -sf mariadb-secure-installation mysql_secure_installation )
( cd usr/bin/32 ; rm -rf mysql_setpermission )
( cd usr/bin/32 ; ln -sf mariadb-setpermission mysql_setpermission )
( cd usr/bin/32 ; rm -rf mysql_tzinfo_to_sql )
( cd usr/bin/32 ; ln -sf mariadb-tzinfo-to-sql mysql_tzinfo_to_sql )
( cd usr/bin/32 ; rm -rf mysql_upgrade )
( cd usr/bin/32 ; ln -sf mariadb-upgrade mysql_upgrade )
( cd usr/bin/32 ; rm -rf mysql_waitpid )
( cd usr/bin/32 ; ln -sf mariadb-waitpid mysql_waitpid )
( cd usr/bin/32 ; rm -rf mysqlaccess )
( cd usr/bin/32 ; ln -sf mariadb-access mysqlaccess )
( cd usr/bin/32 ; rm -rf mysqladmin )
( cd usr/bin/32 ; ln -sf mariadb-admin mysqladmin )
( cd usr/bin/32 ; rm -rf mysqlbinlog )
( cd usr/bin/32 ; ln -sf mariadb-binlog mysqlbinlog )
( cd usr/bin/32 ; rm -rf mysqlcheck )
( cd usr/bin/32 ; ln -sf mariadb-check mysqlcheck )
( cd usr/bin/32 ; rm -rf mysqld_multi )
( cd usr/bin/32 ; ln -sf mariadbd-multi mysqld_multi )
( cd usr/bin/32 ; rm -rf mysqld_safe )
( cd usr/bin/32 ; ln -sf mariadbd-safe mysqld_safe )
( cd usr/bin/32 ; rm -rf mysqld_safe_helper )
( cd usr/bin/32 ; ln -sf mariadbd-safe-helper mysqld_safe_helper )
( cd usr/bin/32 ; rm -rf mysqldump )
( cd usr/bin/32 ; ln -sf mariadb-dump mysqldump )
( cd usr/bin/32 ; rm -rf mysqldumpslow )
( cd usr/bin/32 ; ln -sf mariadb-dumpslow mysqldumpslow )
( cd usr/bin/32 ; rm -rf mysqlhotcopy )
( cd usr/bin/32 ; ln -sf mariadb-hotcopy mysqlhotcopy )
( cd usr/bin/32 ; rm -rf mysqlimport )
( cd usr/bin/32 ; ln -sf mariadb-import mysqlimport )
( cd usr/bin/32 ; rm -rf mysqlshow )
( cd usr/bin/32 ; ln -sf mariadb-show mysqlshow )
( cd usr/bin/32 ; rm -rf mysqlslap )
( cd usr/bin/32 ; ln -sf mariadb-slap mysqlslap )
( cd usr/bin/32 ; rm -rf mysqltest )
( cd usr/bin/32 ; ln -sf mariadb-test mysqltest )
( cd usr/bin/32 ; rm -rf mysqltest_embedded )
( cd usr/bin/32 ; ln -sf mariadb-test-embedded mysqltest_embedded )
( cd usr/bin/32 ; rm -rf wsrep_sst_rsync_wan )
( cd usr/bin/32 ; ln -sf wsrep_sst_rsync wsrep_sst_rsync_wan )
( cd usr/lib ; rm -rf libmariadb.so )
( cd usr/lib ; ln -sf libmariadb.so.3 libmariadb.so )
( cd usr/lib ; rm -rf libmariadbd.so )
( cd usr/lib ; ln -sf libmariadbd.so.19 libmariadbd.so )
( cd usr/lib ; rm -rf libmysqlclient.so )
( cd usr/lib ; ln -sf libmariadb.so.3 libmysqlclient.so )
( cd usr/lib ; rm -rf libmysqlclient_r.so )
( cd usr/lib ; ln -sf libmariadb.so.3 libmysqlclient_r.so )
( cd usr/lib ; rm -rf libmysqld.so )
( cd usr/lib ; ln -sf libmariadbd.so.19 libmysqld.so )
