summaryrefslogtreecommitdiffstats
path: root/ffxpi
blob: 1de0dedcb61e7527157327dfd59d91f3df13f5e0 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/sh

getxpi() {
	if [ x$1 = x ]
	then	
		echo "ERREUR : Numero de version absent !"
	else 	
		if [ x$1 = xtrunk ]
		then	URL=http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk-l10n/linux-xpi/
		elif [ x$2 = x ]
		then	URL=http://releases.mozilla.org/pub/mozilla.org/firefox/releases/$1/linux-i686/xpi
		else	URL=ftp://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/$1-candidates/$2/linux-i686/xpi/
		fi
		# 85 max extensions (21+20+20+20+4)
		for i in af ak ar as ast be bg bn-BD bn-IN br bs ca cs cy da de el en-GB en-ZA eo es-AR \
			es-CL es-ES es-MX et eu	fa fi fr fy-NL ga-IE gd gl gu-IN he hi-IN hr hu hy-AM id is it \
			ja ka kk kn ko ku lg lt lv mai mk ml mn mr nb-NO nl nn-NO nso oc or \
                        pa-IN pl pt-BR pt-PT rm ro ru si sk sl son sq sr sv-SE ta ta-LK te th tr uk \
                        vi zh-CN zh-TW zu
		do 	echo -en "$i\t"
			[ -f $i.xpi ] && echo "already downloaded"
			[ -f $i.xpi ] || wget -nv $URL/$i.xpi
		done
		echo -n "Number of XPI found: "
		ls *.xpi | wc -l
	fi
}

checkxpi() {
	[ -d tmp ] && rm -rf tmp/* || mkdir tmp

	for i in *.xpi
	do	j=$(basename $i .xpi)
		unzip -q $i -d tmp/$j
	done

	xmlwf tmp/*/install.rdf
}
packxpi() {
	if [ x$1 = x ]
	then	
		echo "ERREUR : langue absente !"
	elif [ ! -d tmp/$1 ]
	then
		echo "ERREUR : langue $1 absente !"
	else 	
		echo Création de $1.xpi
		mv $1.xpi /tmp
		cd tmp/$1
		zip ../../$1.xpi -r install.rdf chrome/* chrome.manifest

		echo -n "Controle... "
		xmlwf install.rdf && echo done
	fi
}
donexpi() {
	cd ..
	if [ x$1 = x ]
	then
		echo "ERREUR : Numero de version absent !"

	elif [ x$1 = xtrunk ]
	then
		echo "Création de /home/rpmbuild/SOURCES/firefox-langpacks-trunk.tar.bz2"
		tar cvjf /home/rpmbuild/SPECS/remirepo/firefox4/firefox-langpacks-trunk.tar.bz2 \
			--exclude tmp firefox-langpacks
	else 	
	        case $1 in
	                7*)     dest=firefox7
	                        ;;
	                6*)     dest=firefox6
	                        ;;
	                5*)     dest=firefox5
	                        ;;
	                4*)     dest=firefox4
	                        ;;
	                *)      dest=firefox
	                        ;;
	        esac
		echo "Création de /home/rpmbuild/SPECS/remirepo/$dest/firefox-langpacks-$1-$(date +%Y%m%d).tar.bz2"
		tar cvjf /home/rpmbuild/SPECS/remirepo/$dest/firefox-langpacks-$1-$(date +%Y%m%d).tar.bz2 \
			--exclude tmp firefox-langpacks
	fi
}

dir=/dev/shm/firefox-langpacks

[ -d $dir ] || (mkdir $dir && echo $dir created)
cd $dir

case "$1" in
get)	getxpi $2 $3
	;;
check)	checkxpi
	;;
pack)	packxpi $2
	;;
done)	donexpi $2
	;;
*)	echo -e "\nusage $0 action\n"
	echo -e "\t get version [ rc# ]"
	echo -e "\t check"
	echo -e "\t pack langue"
	echo -e "\t done version"
	echo ""
	;;
esac