xref: /freebsd/tools/diag/localeck/docheck.sh (revision d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf)
1ac6e0aedSAlexey Zelkin#!/bin/sh
2ac6e0aedSAlexey Zelkin#
3ac6e0aedSAlexey Zelkin# Validate all locales installed in specified directory
4ac6e0aedSAlexey Zelkin# (by default check system locales)
5ac6e0aedSAlexey Zelkin#
6ac6e0aedSAlexey Zelkin#
7ac6e0aedSAlexey Zelkin
8ac6e0aedSAlexey ZelkinLOCALEDIR=/usr/share/locale
9ac6e0aedSAlexey Zelkin
10ac6e0aedSAlexey Zelkinif [ "$1" != "" ]; then
11ac6e0aedSAlexey Zelkin	LOCALEDIR=$1
12ac6e0aedSAlexey Zelkinfi
13ac6e0aedSAlexey Zelkin
14ac6e0aedSAlexey Zelkinif [ ! -x ./localeck ]; then
15ac6e0aedSAlexey Zelkin	echo "ERROR: build test program first."
16ac6e0aedSAlexey Zelkin	exit 1
17ac6e0aedSAlexey Zelkinfi
18ac6e0aedSAlexey Zelkin
19ac6e0aedSAlexey ZelkinPATH_LOCALE=$LOCALEDIR
20ac6e0aedSAlexey ZelkinLOCALES=0
21ac6e0aedSAlexey ZelkinERRORS=0
22ac6e0aedSAlexey Zelkin
23ac6e0aedSAlexey Zelkinecho "Validating locales in $LOCALEDIR"
24ac6e0aedSAlexey Zelkinecho
25ac6e0aedSAlexey Zelkin
26ac6e0aedSAlexey Zelkinfor i in `ls -1 $LOCALEDIR`
27ac6e0aedSAlexey Zelkindo
28364a805bSAlexey Zelkin	LOCALES=$(($LOCALES + 1))
29364a805bSAlexey Zelkin	./localeck $i || ERRORS=$(($ERRORS + 1))
30ac6e0aedSAlexey Zelkindone
31ac6e0aedSAlexey Zelkin
32ac6e0aedSAlexey Zelkinecho
33364a805bSAlexey Zelkinecho "Validation test complete"
34364a805bSAlexey Zelkinecho "$LOCALES locales were checked"
35364a805bSAlexey Zelkinecho "$ERRORS invalid locales were found"
36ac6e0aedSAlexey Zelkin
37