File: pkgos-merge-templates

package info (click to toggle)
openstack-pkg-tools 139
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 940 kB
  • sloc: sh: 4,216; makefile: 31
file content (57 lines) | stat: -rwxr-xr-x 1,489 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
50
51
52
53
54
55
56
57
#!/bin/sh

set -e

PKG_NAME=${1}
shift

TEMPLATE_NAME=${1}
shift

# Fetch all the templates we need from argv
# because we will iterate more than once on them
TEMPLATES=""
for i in $@ ; do
	if [ -n "${TEMPLATES}" ] ; then
		TEMPLATES="${TEMPLATES} "
	fi
	TEMPLATES="${TEMPLATES}${1}"
	shift
done

# Concat an eventual package specific template
if [ -e debian/${PKG_NAME}.templates.in ] ; then
	cat debian/${PKG_NAME}.templates.in >>debian/${PKG_NAME}.templates
fi

# Concat all the stuff asked
for i in ${TEMPLATES} ; do
	cat /usr/share/openstack-pkg-tools/debconf-templates/openstack-pkg-tools.configure-${i}.templates >>debian/${PKG_NAME}.templates
done

# Fix the name of the templates
sed -i 's|Template: ospt/|Template: '${TEMPLATE_NAME}'/|' debian/${PKG_NAME}.templates

# Concat all the translations
mkdir -p debian/po
for i in $(ls /usr/share/openstack-pkg-tools/debconf-templates/po/*.po) ; do
	BASENAME=$(basename $i)
	echo "Merging ${BASENAME}..."
	if [ -e debian/po/${BASENAME} ] ; then
		msgmerge -q $i debian/po/${BASENAME} 2>&1 >/dev/null
	else
		cp $i debian/po/
	fi
done

# Check for POTFILES.in consistency
# (ie: ensure it has our templates listed)
touch debian/po/POTFILES.in
for i in ${TEMPLATES} ; do
	if ! grep -q "\[type: gettext/rfc822deb\] ${PKG_NAME}.templates" debian/po/POTFILES.in ; then
		echo "[type: gettext/rfc822deb] ${PKG_NAME}.templates" >>debian/po/POTFILES.in
	fi
done

# Finally, run the debconf-updatepo to merge all translations
#debconf-updatepo