xref: /freebsd/tools/diag/localeck/docheck.sh (revision 364a805b9fd3c306ff3cbf58e8854d7771f0e3f7)
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# $FreeBSD$
7ac6e0aedSAlexey Zelkin#
8ac6e0aedSAlexey Zelkin
9ac6e0aedSAlexey ZelkinLOCALEDIR=/usr/share/locale
10ac6e0aedSAlexey Zelkin
11ac6e0aedSAlexey Zelkinif [ "$1" != "" ]; then
12ac6e0aedSAlexey Zelkin	LOCALEDIR=$1
13ac6e0aedSAlexey Zelkinfi
14ac6e0aedSAlexey Zelkin
15ac6e0aedSAlexey Zelkinif [ ! -x ./localeck ]; then
16ac6e0aedSAlexey Zelkin	echo "ERROR: build test program first."
17ac6e0aedSAlexey Zelkin	exit 1
18ac6e0aedSAlexey Zelkinfi
19ac6e0aedSAlexey Zelkin
20ac6e0aedSAlexey ZelkinPATH_LOCALE=$LOCALEDIR
21ac6e0aedSAlexey ZelkinLOCALES=0
22ac6e0aedSAlexey ZelkinERRORS=0
23ac6e0aedSAlexey Zelkin
24ac6e0aedSAlexey Zelkinecho "Validating locales in $LOCALEDIR"
25ac6e0aedSAlexey Zelkinecho
26ac6e0aedSAlexey Zelkin
27ac6e0aedSAlexey Zelkinfor i in `ls -1 $LOCALEDIR`
28ac6e0aedSAlexey Zelkindo
29364a805bSAlexey Zelkin	LOCALES=$(($LOCALES + 1))
30364a805bSAlexey Zelkin	./localeck $i || ERRORS=$(($ERRORS + 1))
31ac6e0aedSAlexey Zelkindone
32ac6e0aedSAlexey Zelkin
33ac6e0aedSAlexey Zelkinecho
34364a805bSAlexey Zelkinecho "Validation test complete"
35364a805bSAlexey Zelkinecho "$LOCALES locales were checked"
36364a805bSAlexey Zelkinecho "$ERRORS invalid locales were found"
37ac6e0aedSAlexey Zelkin
38