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 mariadb )
( cd usr/bin/32 ; ln -sf mysql mariadb )
( cd usr/bin/32 ; rm -rf mariadb-access )
( cd usr/bin/32 ; ln -sf mysqlaccess mariadb-access )
( cd usr/bin/32 ; rm -rf mariadb-admin )
( cd usr/bin/32 ; ln -sf mysqladmin mariadb-admin )
( cd usr/bin/32 ; rm -rf mariadb-backup )
( cd usr/bin/32 ; ln -sf mariabackup mariadb-backup )
( cd usr/bin/32 ; rm -rf mariadb-binlog )
( cd usr/bin/32 ; ln -sf mysqlbinlog mariadb-binlog )
( cd usr/bin/32 ; rm -rf mariadb-check )
( cd usr/bin/32 ; ln -sf mysqlcheck mariadb-check )
( cd usr/bin/32 ; rm -rf mariadb-client-test )
( cd usr/bin/32 ; ln -sf mysql_client_test mariadb-client-test )
( cd usr/bin/32 ; rm -rf mariadb-client-test-embedded )
( cd usr/bin/32 ; ln -sf mysql_client_test_embedded mariadb-client-test-embedded )
( cd usr/bin/32 ; rm -rf mariadb-convert-table-format )
( cd usr/bin/32 ; ln -sf mysql_convert_table_format mariadb-convert-table-format )
( cd usr/bin/32 ; rm -rf mariadb-dump )
( cd usr/bin/32 ; ln -sf mysqldump mariadb-dump )
( cd usr/bin/32 ; rm -rf mariadb-dumpslow )
( cd usr/bin/32 ; ln -sf mysqldumpslow mariadb-dumpslow )
( cd usr/bin/32 ; rm -rf mariadb-embedded )
( cd usr/bin/32 ; ln -sf mysql_embedded mariadb-embedded )
( cd usr/bin/32 ; rm -rf mariadb-find-rows )
( cd usr/bin/32 ; ln -sf mysql_find_rows mariadb-find-rows )
( cd usr/bin/32 ; rm -rf mariadb-fix-extensions )
( cd usr/bin/32 ; ln -sf mysql_fix_extensions mariadb-fix-extensions )
( cd usr/bin/32 ; rm -rf mariadb-hotcopy )
( cd usr/bin/32 ; ln -sf mysqlhotcopy mariadb-hotcopy )
( cd usr/bin/32 ; rm -rf mariadb-import )
( cd usr/bin/32 ; ln -sf mysqlimport mariadb-import )
( cd usr/bin/32 ; rm -rf mariadb-install-db )
( cd usr/bin/32 ; ln -sf mysql_install_db mariadb-install-db )
( cd usr/bin/32 ; rm -rf mariadb-plugin )
( cd usr/bin/32 ; ln -sf mysql_plugin mariadb-plugin )
( cd usr/bin/32 ; rm -rf mariadb-secure-installation )
( cd usr/bin/32 ; ln -sf mysql_secure_installation mariadb-secure-installation )
( cd usr/bin/32 ; rm -rf mariadb-setpermission )
( cd usr/bin/32 ; ln -sf mysql_setpermission mariadb-setpermission )
( cd usr/bin/32 ; rm -rf mariadb-show )
( cd usr/bin/32 ; ln -sf mysqlshow mariadb-show )
( cd usr/bin/32 ; rm -rf mariadb-slap )
( cd usr/bin/32 ; ln -sf mysqlslap mariadb-slap )
( cd usr/bin/32 ; rm -rf mariadb-test )
( cd usr/bin/32 ; ln -sf mysqltest mariadb-test )
( cd usr/bin/32 ; rm -rf mariadb-test-embedded )
( cd usr/bin/32 ; ln -sf mysqltest_embedded mariadb-test-embedded )
( cd usr/bin/32 ; rm -rf mariadb-tzinfo-to-sql )
( cd usr/bin/32 ; ln -sf mysql_tzinfo_to_sql mariadb-tzinfo-to-sql )
( cd usr/bin/32 ; rm -rf mariadb-upgrade )
( cd usr/bin/32 ; ln -sf mysql_upgrade mariadb-upgrade )
( cd usr/bin/32 ; rm -rf mariadb-waitpid )
( cd usr/bin/32 ; ln -sf mysql_waitpid mariadb-waitpid )
( cd usr/bin/32 ; rm -rf mariadbd-multi )
( cd usr/bin/32 ; ln -sf mysqld_multi mariadbd-multi )
( cd usr/bin/32 ; rm -rf mariadbd-safe )
( cd usr/bin/32 ; ln -sf mysqld_safe mariadbd-safe )
( cd usr/bin/32 ; rm -rf mariadbd-safe-helper )
( cd usr/bin/32 ; ln -sf mysqld_safe_helper mariadbd-safe-helper )
( 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 )
