lang-clean.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/bin/bash
  2. #
  3. # clean.sh - multi-language support script
  4. # Remove all language output files from lang folder.
  5. #
  6. # Config:
  7. echo "CONFIG: $CONFIG_OK"
  8. if [ -z "$CONFIG_OK" ]; then eval "$(cat config.sh)"; fi
  9. if [ -z "$CONFIG_OK" ] | [ $CONFIG_OK -eq 0 ]; then echo 'Config NG!' >&2; exit 1; fi
  10. if [ ! -z "$COMMUNITY_LANGUAGES" ]; then
  11. LANGUAGES+=" $COMMUNITY_LANGUAGES"
  12. fi
  13. result=0
  14. rm_if_exists()
  15. {
  16. if [ -e $1 ]; then
  17. echo -n " removing '$1'..." >&2
  18. if rm $1; then
  19. echo "OK" >&2
  20. else
  21. echo "NG!" >&2
  22. result=1
  23. fi
  24. fi
  25. }
  26. clean_lang()
  27. {
  28. if [ "$1" = "en" ]; then
  29. rm_if_exists lang_$1.tmp
  30. else
  31. rm_if_exists lang_$1.tmp
  32. rm_if_exists lang_en_$1.tmp
  33. rm_if_exists lang_en_$1.dif
  34. rm_if_exists lang_$1.ofs
  35. rm_if_exists lang_$1.txt
  36. fi
  37. rm_if_exists lang_$1_check.dif
  38. rm_if_exists lang_$1.bin
  39. rm_if_exists lang_$1.dat
  40. rm_if_exists lang_$1_1.tmp
  41. rm_if_exists lang_$1_2.tmp
  42. }
  43. #Clean English
  44. clean_lang en
  45. #Clean languages
  46. echo "lang-clean.sh started" >&2
  47. echo "lang-clean languages:$LANGUAGES" >&2
  48. for lang in $LANGUAGES; do
  49. clean_lang $lang
  50. done
  51. echo -n "lang-clean.sh finished" >&2
  52. if [ $result -eq 0 ]; then
  53. echo " with success" >&2
  54. else
  55. echo " with errors!" >&2
  56. fi
  57. case "$-" in
  58. *i*) echo "press enter key" >&2; read ;;
  59. esac
  60. exit $result