summaryrefslogtreecommitdiffstats
path: root/bin/migrate-lang
blob: cd3f09c4bb5d8407b1d373fc458d1469a7935389 (plain)
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
#!/bin/sh
ME=`basename $0`
USAGE="usage: ${ME} [lang ...] | sh"
# By default, we use the languages declared in the Makefile
LANGUAGES=`
	make showvars						|
	fgrep LANGUAGES						|
	sed -e 's/^[^"]*"//' -e 's/".*$//'
`
# Allow language selections to be overridden via the command line
if [ $# -gt 1 ]; then
	LANGUAGES="$@"
fi
# Output the shell script that will show how to do the dirty work
changes=''
echo "#/bin/sh"
for theLang in ${LANGUAGES}
do
	if [ ! -d "${theLang}" ]; then
		echo "echo 'Creating the ${theLang} subdirectory.'"
		echo mkdir "${theLang}"
		echo cvs add "${theLang}"
		changes=yes
	fi
	echo "echo 'Trying to populate the ${theLang} subdirectory.'"
	ls *-${theLang}.xml 2>/dev/null				|
	while read x
	do
		echo "echo 'Considering ${x}'"
		if [ ! -f ${theLang}/${x} ]; then
			echo "cp ${x} ${theLang}/${x}"
			echo "cvs add ${theLang}/${x}"
			changes=yes
		fi
	done
done
if [ "${changes}" ]; then
	echo "echo 'Commit changes to make them permanent.'"
	echo cvs commit
fi