mirror of
https://github.com/brian8544/turtle-wow.git
synced 2024-12-28 10:24:36 +00:00
25 lines
639 B
Bash
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 |