File: translation-check

package info (click to toggle)
localechooser 2.84
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 1,612 kB
  • sloc: sh: 1,096; perl: 187; makefile: 71; awk: 42
file content (49 lines) | stat: -rwxr-xr-x 1,279 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#! /bin/sh
set -e

# Exits without error if translation is _not_ completely up-to-date;
# with errror if translation is up-to-date or on errors.

if [ "$1" = en ] || [ "$1" = C ]; then
	exit 9	# up-to-date by definition
fi

sfile=/usr/share/localechooser/translation-status
[ -f $sfile ] || exit 1

tstatus=$(grep "^$1:" $sfile | sed "s/.*:[[:space:]]*//")
[ "$tstatus" ] || exit 1

tlevel=${tstatus% *}
tcompl=${tstatus#* }
expr "$tlevel" : "[1-5]" >/dev/null || exit 1
expr "$tcompl" : "[FMPLU]" >/dev/null || exit 1

arch=$(archdetect)
case ${arch%/*} in
    i386|amd64)
	archlevel=3 ;;
    arm*|mips*|powerpc|sparc)
	archlevel=4 ;;
    alpha|hppa|ia64|m68k|s390|s390x)
	archlevel=5 ;;
    *)
	archlevel=5 ;;
esac

if [ "$tcompl" = F ]; then
	exit 9	# up-to-date
elif [ $archlevel = 3 ] && [ $tlevel -eq 2 ] && [ $tcompl != M ]; then
	echo 0	# incomplete
elif [ $archlevel = 3 ] && [ $tlevel -eq 2 ]; then
	echo 1	# incomplete, but normal installs mostly OK
elif [ $tlevel -lt $archlevel ] ||
     ([ $tlevel -eq $archlevel ] && [ $tcompl = U ]); then
	echo 0	# incomplete
elif [ $tlevel -eq $archlevel ] && [ $tcompl != M ]; then
	echo 2	# partial at wanted level
elif [ $tlevel -eq $archlevel ]; then
	echo 3	# mostly complete
else
	echo 4	# only exceptions untranslated
fi