xref: /freebsd/tools/diag/localeck/docheck.sh (revision ac6e0aed984781b15d77e33653486f06c0fd516a)
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
29ac6e0aedSAlexey Zelkin	LOCALES=`expr $LOCALES + 1`
30ac6e0aedSAlexey Zelkin	./localeck $i
31ac6e0aedSAlexey Zelkin	if [ $? != 0 ]; then
32ac6e0aedSAlexey Zelkin		ERRORS=`expr $ERRORS + 1`
33ac6e0aedSAlexey Zelkin	fi
34ac6e0aedSAlexey Zelkindone
35ac6e0aedSAlexey Zelkin
36ac6e0aedSAlexey Zelkinecho
37ac6e0aedSAlexey Zelkinecho "Validation test complete."
38ac6e0aedSAlexey Zelkinecho "$LOCALES locale(s) were checked"
39ac6e0aedSAlexey Zelkinecho "$ERRORS invalid locale(s) were found"
40ac6e0aedSAlexey Zelkin
41