92ec7d3d24
WIP
84 lines
2.2 KiB
Bash
Executable File
84 lines
2.2 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Version 1.0.1 Build 9
|
|
#
|
|
# clean.sh - multi-language support script
|
|
# Remove all language output files from lang folder.
|
|
#
|
|
#############################################################################
|
|
# Change log:
|
|
# 1 Nov. 2018, XPila, Initial
|
|
# 17 Dec. 2021, 3d-gussner, Use one config file for all languages
|
|
# 11 Jan. 2022, 3d-gussner, Also remove temporally files which have been
|
|
# generated for message and size count comparison
|
|
# Added version and Change log
|
|
# colored output
|
|
# Add Community language support
|
|
# Use `git rev-list --count HEAD lang-clean.sh`
|
|
# to get Build Nr
|
|
#############################################################################
|
|
# Config:
|
|
if [ -z "$CONFIG_OK" ]; then eval "$(cat config.sh)"; fi
|
|
if [ -z "$CONFIG_OK" ] | [ $CONFIG_OK -eq 0 ]; then echo "$(tput setaf 1)Config NG!$(tput sgr0)" >&2; exit 1; fi
|
|
|
|
if [ ! -z "$COMMUNITY_LANGUAGES" ]; then
|
|
LANGUAGES+=" $COMMUNITY_LANGUAGES"
|
|
fi
|
|
|
|
result=0
|
|
|
|
rm_if_exists()
|
|
{
|
|
if [ -e $1 ]; then
|
|
echo -n "$(tput sgr0) removing $(tput setaf 3)'$1'$(tput sgr0)..." >&2
|
|
if rm $1; then
|
|
echo "$(tput setaf 2)OK$(tput sgr0)" >&2
|
|
else
|
|
echo "$(tput setaf 1)NG!$(tput sgr0)" >&2
|
|
result=1
|
|
fi
|
|
fi
|
|
}
|
|
|
|
clean_lang()
|
|
{
|
|
if [ "$1" = "en" ]; then
|
|
rm_if_exists lang_$1.tmp
|
|
rm_if_exists lang_$1.cnt
|
|
rm_if_exists lang_$1.max
|
|
else
|
|
rm_if_exists lang_$1.tmp
|
|
rm_if_exists lang_en_$1.tmp
|
|
rm_if_exists lang_en_$1.dif
|
|
rm_if_exists lang_$1.ofs
|
|
rm_if_exists lang_$1.txt
|
|
fi
|
|
rm_if_exists lang_$1_check.dif
|
|
rm_if_exists lang_$1.bin
|
|
rm_if_exists lang_$1.dat
|
|
rm_if_exists lang_$1_1.tmp
|
|
rm_if_exists lang_$1_2.tmp
|
|
}
|
|
|
|
echo "$(tput setaf 2)lang-clean.sh started$(tput sgr0)" >&2
|
|
#Clean English
|
|
clean_lang en
|
|
|
|
#Clean languages
|
|
echo "lang-clean languages:$(tput setaf 2)$LANGUAGES$(tput sgr0)" >&2
|
|
for lang in $LANGUAGES; do
|
|
clean_lang $lang
|
|
done
|
|
|
|
if [ $result -eq 0 ]; then
|
|
echo "$(tput setaf 2) lang-clean.sh with success$(tput sgr0)" >&2
|
|
else
|
|
echo "$(tput setaf 1) lang-clean.sh with errors!$(tput sgr0)" >&2
|
|
fi
|
|
|
|
case "$-" in
|
|
*i*) echo "press enter key" >&2; read ;;
|
|
esac
|
|
|
|
exit $result
|