| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
set -e |
| 4 |
|
| 5 |
PKG_NAME=${1} |
| 6 |
shift |
| 7 |
|
| 8 |
TEMPLATE_NAME=${1} |
| 9 |
shift |
| 10 |
|
| 11 |
# Fetch all the templates we need from argv |
| 12 |
# because we will iterate more than once on them |
| 13 |
TEMPLATES="" |
| 14 |
for i in $@ ; do |
| 15 |
if [ -n "${TEMPLATES}" ] ; then |
| 16 |
TEMPLATES="${TEMPLATES} " |
| 17 |
fi |
| 18 |
TEMPLATES="${TEMPLATES}${1}" |
| 19 |
shift |
| 20 |
done |
| 21 |
|
| 22 |
# Concat an eventual package specific template |
| 23 |
if [ -e debian/${PKG_NAME}.templates.in ] ; then |
| 24 |
cat debian/${PKG_NAME}.templates.in >>debian/${PKG_NAME}.templates |
| 25 |
fi |
| 26 |
|
| 27 |
# Concat all the stuff asked |
| 28 |
for i in ${TEMPLATES} ; do |
| 29 |
cat /usr/share/openstack-pkg-tools/debconf-templates/openstack-pkg-tools.configure-${i}.templates >>debian/${PKG_NAME}.templates |
| 30 |
done |
| 31 |
|
| 32 |
# Fix the name of the templates |
| 33 |
sed -i 's|Template: ospt/|Template: '${TEMPLATE_NAME}'/|' debian/${PKG_NAME}.templates |
| 34 |
|
| 35 |
# Concat all the translations |
| 36 |
mkdir -p debian/po |
| 37 |
for i in $(ls /usr/share/openstack-pkg-tools/debconf-templates/po/*.po) ; do |
| 38 |
BASENAME=$(basename $i) |
| 39 |
echo "Merging ${BASENAME}..." |
| 40 |
if [ -e debian/po/${BASENAME} ] ; then |
| 41 |
msgmerge -q $i debian/po/${BASENAME} 2>&1 >/dev/null |
| 42 |
else |
| 43 |
cp $i debian/po/ |
| 44 |
fi |
| 45 |
done |
| 46 |
|
| 47 |
# Check for POTFILES.in consistency |
| 48 |
# (ie: ensure it has our templates listed) |
| 49 |
touch debian/po/POTFILES.in |
| 50 |
for i in ${TEMPLATES} ; do |
| 51 |
if ! grep -q "\[type: gettext/rfc822deb\] ${PKG_NAME}.templates" debian/po/POTFILES.in ; then |
| 52 |
echo "[type: gettext/rfc822deb] ${PKG_NAME}.templates" >>debian/po/POTFILES.in |
| 53 |
fi |
| 54 |
done |
| 55 |
|
| 56 |
# Finally, run the debconf-updatepo to merge all translations |
| 57 |
#debconf-updatepo |