2020-06-22 19:04:40 +00:00
|
|
|
#!/usr/bin/bash
|
2021-05-14 16:52:38 +00:00
|
|
|
# SPDX-License-Identifier: MIT
|
2020-06-22 19:04:40 +00:00
|
|
|
#
|
2021-05-14 16:52:38 +00:00
|
|
|
# EmulationStation Desktop Edition
|
|
|
|
# update_theme_formatversion.sh
|
2020-06-22 19:04:40 +00:00
|
|
|
#
|
2021-05-14 16:52:38 +00:00
|
|
|
# Updates the format version of all the XML files in a theme set.
|
2021-08-24 16:17:06 +00:00
|
|
|
# This needs to be run from the theme directory, e.g.:
|
|
|
|
# cd themes/rbsimple-DE && ../../tools/update_theme_formatversion.sh 5 6
|
2020-12-30 13:19:18 +00:00
|
|
|
#
|
2021-05-14 16:52:38 +00:00
|
|
|
# This script is only intended to be used on Linux systems.
|
2020-06-22 19:04:40 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
if [ $# -ne 2 ]; then
|
|
|
|
echo "Usage: ./update_theme_formatversion.sh <old theme version> <new theme version>"
|
|
|
|
echo "For example:"
|
|
|
|
echo "./update_theme_formatversion.sh 5 6"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
TEMPFILE_FILELIST=tempfile_filelist_$(date +%H%M%S)
|
|
|
|
TEMPFILE_PROCESS=tempfile_process_$(date +%H%M%S)
|
|
|
|
OLDVERSION=$1
|
|
|
|
NEWVERSION=$2
|
|
|
|
|
|
|
|
find . -name '*.xml' > $TEMPFILE_FILELIST
|
|
|
|
|
|
|
|
for file in $(cat $TEMPFILE_FILELIST); do
|
|
|
|
echo "Processing file:" $file
|
|
|
|
cat $file | sed s/"<formatVersion>${OLDVERSION}"/"<formatVersion>${NEWVERSION}"/g > \
|
|
|
|
$TEMPFILE_PROCESS
|
|
|
|
mv $TEMPFILE_PROCESS $file
|
|
|
|
done
|
|
|
|
|
|
|
|
rm $TEMPFILE_FILELIST
|