turtle-wow-source-kinda/Dumps/Source Code/20 - Development_turtle-logs/main/Exporter/Database/merger.sh
Brian Oost a1d5bb70b2 Init
2024-08-06 18:06:40 +02:00

25 lines
639 B
Bash

if [ ! -f "/var/lib/mysql/db_patch_count" ]; then
echo "-1" > /var/lib/mysql/db_patch_count
fi
COUNT=$(cat /var/lib/mysql/db_patch_count)
COUNT=$(expr ${COUNT} + 0)
if [ -f "/var/lib/mysql/merge.sql" ]; then
rm /var/lib/mysql/merge.sql
fi
for filename in ./patches/*.zip; do
if [ ! -f "${filename}" ]; then
continue
fi
FILE=${filename:10}
VERSION=$(expr ${FILE:0:5} + 0)
if (( ${VERSION} > ${COUNT} )); then
unzip ${filename}
cat ${filename:10:-4}.sql >> /var/lib/mysql/merge.sql
echo "" >> /var/lib/mysql/merge.sql
echo ${VERSION} > /var/lib/mysql/db_patch_count
rm ${filename:10:-4}.sql
fi
done