This file is indexed.

/usr/bin/po4a-build is in po4a 0.52-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
#!/bin/sh
set -e

#  Copyright (C) 2006-2009  Neil Williams <codehelp@debian.org>
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 3 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.

# pull in /usr/bin/gettext.sh
. gettext.sh

TEXTDOMAIN="po4a"
export TEXTDOMAIN
# this DIR might need to be configurable.
TEXTDOMAINDIR="/usr/share/locale"
export TEXTDOMAINDIR

# DEFAULTS:
# name and location of the config file
# relative to the top level source directory of the translations
# i.e. the directory containing ./po/
CONFIG="po4a.config"
# PODIR po directory for manpages/docs
PODIR="po"
# POTFILE path
POTFILE=""
# base directory for generated files, e.g. doc
BASEDIR=""
# the binary packages that will contain generated manpages
BINARIES=""
# the Docbook XML manpages for Section 3.
XMLMAN3=""
# the binary packages using DocBook XML & xsltproc
XMLPACKAGES=""
# the DocBook XML files for Section 1.
XMLMAN1=""
# the pattern to find the XML files
XMLDIR=""
# the pattern to find the .docbook files
DOCBOOKDIR=""
# the XSL file to use for Docbook XSL
XSLFILE="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"
# the POD files for man1
PODFILE=""
# the POD files for man3/ - module names regenerated from the path.
PODMODULES=""
# POD files for section 7
POD7FILES=""
# POD files for section 5
POD5FILES=""
# the binary packages using POD
PODPACKAGES=""
# html output (subdirectory of BASEDIR)
HTMLDIR=""
# html DocBook file
HTMLFILE=""
# the XSL file to use for Docbook XSL
HTMLXSL="http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl"
# Minimal threshold for translation percentage to keep
KEEP=

# remember to add something to the clean:: rule in debian/rules
# to remove each binary package sub-directory.
# $(RM) -r doc/emdebian-rootfs doc/multistrap

# below this point, no changes should be needed.

# use a default po4a-build.cnf in the current directory.
FILE="po4a-build.conf"

wrap_langs () {
	if [ -z "$LANGS" ]; then
		echo "$1 $2" >> $CONFIG
	else
		echo "$1 $2 $3" >> $CONFIG
	fi
}

usagehelp () {
	# print out help message
	eval_gettext "
po4a-build - po4a frontend

Syntax: po4a-build
        po4a-build --pot-only

Commands:
-?|-h|--help|--version:     print this help message and exit
--pot-only:                 only create the POT file

Options:
-f|--file FILE:             po4a-build.conf config file path

"; echo
}

while [ -n "$1" ]; do
case "$1" in
	--help|-h|-\?|--version)
		usagehelp
		exit;
	;;
	--pot-only)
		POTONLY=1
		shift
	;;
	-f|--file)
		shift
		FILE=$1
		shift
	;;
	*)
		com=$1
		eval_gettext "Unrecognised command: \$com"; echo
	exit;
	;;
esac
done

if [ ! -f "$FILE" ]; then
	# without config, there's nothing to do.
	eval_gettext "Cannot find config file! '\$FILE'"; echo
	exit 3
else
	. ./$FILE
fi
OURS=`pwd|tr -d '\n'`
cd `dirname $FILE`

if [ "$USE_INTERNAL_PO4A" = "yes" ]; then
	TEXTDOMAINDIR=$OURS/blib/po
fi

# calculate the langs, automatically.
LANGS=`ls $PODIR/*.po 2>/dev/null || true`
if [ ! -z "$LANGS" ]; then
	LANGS=`ls $PODIR/*.po | sed -e 's/.*\/\(.*\)\.po/\1 /' || true`
fi
if [ ! -z "$LANGS" ]; then
	LANGS=`echo $LANGS|tr -d '\n'`
	echo "[po4a_langs] $LANGS" > $CONFIG
	else
	echo > $CONFIG
fi
wrap_langs "[po4a_paths]" "$POTFILE" "\$lang:$PODIR/\$lang.po"

if [ -n "$XMLDIR" ]; then
	for file in $XMLDIR/*.xml; do
		LOCAL=`basename $file`
		wrap_langs "[type:docbook]" "$file" "\$lang:$XMLDIR/\$lang/$LOCAL"
	done
fi
if [ -n "$DOCBOOKDIR" ]; then
	for file in $DOCBOOKDIR; do
		LOCAL=`basename $file`
		wrap_langs "[type:docbook]" "$file" "\$lang:$BASEDIR/\$lang/$LOCAL"
	done
fi
if [ -n "$PODFILE" ]; then
	for file in $PODFILE; do
		LOCAL=`basename $file`
		wrap_langs "[type:pod]" "$file" "\$lang:$BASEDIR/pod/1/\$lang/$LOCAL"
	done
fi
if [ -n "$POD5FILES" ]; then
	for file in $POD5FILES; do
		LOCAL=`basename $file`
		wrap_langs "[type:pod]" "$file" "\$lang:$BASEDIR/pod/5/\$lang/$LOCAL"
	done
fi
if [ -n "$POD7FILES" ]; then
	for file in $POD7FILES; do
		LOCAL=`basename $file`
		wrap_langs "[type:pod]" "$file" "\$lang:$BASEDIR/pod/7/\$lang/$LOCAL"
	done
fi
if [ -n "$PODMODULES" ]; then
	for file in $PODMODULES; do
		wrap_langs "[type:pod]" "$file" "\$lang:$BASEDIR/pod/3/\$lang/$file"
	done
fi

if [ "$POTONLY" = "1" ]; then
	# Allow internal builds within po4a
	if [ "$USE_INTERNAL_PO4A" = "yes" ]; then
		# test
		eval_gettext "Internal po4a from \$OURS being used instead of /usr/bin/"; echo
		PERL5LIB=$OURS/lib perl $OURS/po4a --no-translations $CONFIG
	else
		po4a --no-translations $CONFIG
	fi
	exit
fi

for d in $BINARIES; do
	for l in $LANGS; do
		mkdir -p $BASEDIR/$d/man/$l/man1/
		if [ "$d" = "$XMLsMAN3" ]; then
			mkdir -p $BASEDIR/$d/man/$l/man3/
		fi
		if [ -n "$PODMODULES" ]; then
			mkdir -p $BASEDIR/$d/man/$l/man3/
		fi
		if [ -n "$HTMLDIR" ]; then
			mkdir -p $BASEDIR/$d/$l/$HTMLDIR/
		fi
		if [ -n "$POD5FILES" ]; then
			mkdir -p $BASEDIR/$d/man/$l/man5/
		fi
		if [ -n "$POD7FILES" ]; then
			mkdir -p $BASEDIR/$d/man/$l/man7/
		fi
	done
	mkdir -p $BASEDIR/$d/man/man1/
	if [ "$d" = "$XMLMAN3" ]; then
		mkdir -p $BASEDIR/$d/man/man3/
	fi
	mkdir -p $BASEDIR/pod/$l/
	if [ -n "$PODMODULES" ]; then
		mkdir -p $BASEDIR/$d/man/man3/
	fi
	if [ -n "$POD5FILES" ]; then
		mkdir -p $BASEDIR/$d/man/man5/
	fi
	if [ -n "$POD7FILES" ]; then
		mkdir -p $BASEDIR/$d/man/man7/
	fi
done

# use -k to create all XML even if untranslated or the XSL breaks the build.
if [ -n "$KEEP" ]; then
	K="-k $KEEP"
fi

# Allow internal builds within po4a
if [ "$USE_INTERNAL_PO4A" = "yes" ]; then
	eval_gettext "Internal po4a from \$OURS being used instead of /usr/bin/"; echo
	PERL5LIB=$OURS/lib perl $OURS/po4a $K $CONFIG
else
	po4a $K $CONFIG
fi

for d in $BINARIES; do
	for P in $XMLPACKAGES; do
		if [ $d = $P ]; then
			for X in $XMLMAN1; do
				# TRANSLATORS: $X contains the name of the manual page
				eval_gettext "Processing untranslated files for \$X (1). . ."; echo
				MANDIR=$BASEDIR/$P/man/man1/
				XML_CATALOG_FILES="/etc/xml/catalog" \
				xsltproc -o $MANDIR --nonet $XSLFILE $XMLDIR/$X
			done
			for X3 in $XMLMAN3; do
				# TRANSLATORS: $X3 contains the name of the manual page
				eval_gettext "Processing untranslated files for \$X3 (3). . ."; echo
				MANDIR=$BASEDIR/$P/man/man3/
				XML_CATALOG_FILES="/etc/xml/catalog" \
				xsltproc -o $MANDIR --nonet $XSLFILE $XMLDIR/$X3
			done
		fi
	done
	for POD in $PODPACKAGES; do
		if [ $d = "$POD" ]; then
			for file in $PODFILE; do
				LOCAL=`basename $file`
				# TRANSLATORS: $file contains the basename of the POD file
				eval_gettext "Processing untranslated files for \$file (1) . . ."; echo
				pod2man -s 1 $file $BASEDIR/$POD/man/man1/$LOCAL.1
			done
			if [ -n "$PODMODULES" ]; then
				for file in $PODMODULES; do
					# a bit of sed magic to convert a path to a module name.
					name=`echo $file| sed -e 's/^lib\///'|sed -e 's/\//::/g'|sed -e 's/\.pm$//'`
					# TRANSLATORS: $name contains the Perl module name
					eval_gettext "Processing untranslated files for \$name (3) . . ."; echo
					pod2man -s 3 $file $BASEDIR/$POD/man/man3/$name.3
				done
			fi
			if [ -n "$POD5FILES" ]; then
				for file in $POD5FILES; do
					LOCAL=`basename $file`
					# TRANSLATORS: $file contains the basename of the POD file
					eval_gettext "Processing untranslated files for \$file (5) . . ."; echo
					# shorten names that already contain the 5.
					SHORT=`echo $LOCAL|cut -d'5' -f1|sed -e 's/\.$//'`
					if [ -n "$SHORT" ]; then
						pod2man -s 5 $file $BASEDIR/$POD/man/man5/${SHORT}.5
					else
						pod2man -s 5 $file $BASEDIR/$POD/man/man5/${LOCAL}.5
					fi
				done
			fi
			if [ -n "$POD7FILES" ]; then
				for file in $POD7FILES; do
					LOCAL=`basename $file`
					# TRANSLATORS: $file contains the basename of the POD file
					eval_gettext "Processing untranslated files for \$file (7) . . ."; echo
					# shorten names that already contain the 7.
					SHORT=`echo $LOCAL|cut -d'7' -f1|sed -e 's/\.$//'`
					if [ -n "$SHORT" ]; then
						pod2man -s 7 $file $BASEDIR/$POD/man/man7/${SHORT}.7
					else
						pod2man -s 7 $file $BASEDIR/$POD/man/man7/${LOCAL}.7
					fi
				done
			fi
		fi
	done
	if [ -n "$HTMLDIR" ]; then
		xsltproc -o $BASEDIR/$d/$HTMLDIR/ --nonet $HTMLXSL $XMLDIR/$HTMLFILE
	fi
	for l in $LANGS; do
		for P in $XMLPACKAGES; do
			if [ $d = "$P" ]; then
				for X in $XMLMAN1; do
					if [ -f $XMLDIR/$l/$X ]; then
						# TRANSLATORS: $l contains language code, $X contains the name of the manual page
						eval_gettext "Processing \$l translations for \$X (1). . ."; echo
						MANDIR=$BASEDIR/$P/man/$l/man1/
						XML_CATALOG_FILES="/etc/xml/catalog" \
						xsltproc -o $MANDIR --nonet $XSLFILE $XMLDIR/$l/$X
					fi
				done
				for X3 in $XMLMAN3; do
					if [ -f $XMLDIR/$l/$X3 ]; then
						# TRANSLATORS: $l contains language code, $X3 contains the name of the manual page
						eval_gettext "Processing \$l translations for \$X3 (3). . ."; echo
						MANDIR=$BASEDIR/$P/man/$l/man3/
						XML_CATALOG_FILES="/etc/xml/catalog" \
						xsltproc -o $MANDIR --nonet $XSLFILE $XMLDIR/$l/$X3
					fi
				done
			fi
		done
		for POD in $PODPACKAGES; do
			if [ $d = "$POD" ]; then
				for file in $PODFILE; do
					LOCAL=`basename $file`
					if [ -f $BASEDIR/pod/1/$l/$LOCAL ]; then
						# TRANSLATORS: $l contains language code, $file contains the basename of the POD file
						eval_gettext "Processing \$l translations for \$file (1). . ."; echo
						pod2man --utf8 -s 1 $BASEDIR/pod/1/$l/$LOCAL $BASEDIR/$POD/man/$l/man1/$LOCAL.1
					fi
				done
			fi
			if [ -n "$PODMODULES" ]; then
				for file in $PODMODULES; do
					# a bit of sed magic to convert a path to a module name.
					name=`echo $file| sed -e 's/^lib\///'|sed -e 's/\//::/g'|sed -e 's/\.pm$//'`
					if [ -f $BASEDIR/pod/3/$l/$file ]; then
						# TRANSLATORS: $l contains language code, $name contains the Perl module name
						eval_gettext "Processing \$l translations for \$name (3). . ."; echo
						pod2man --utf8 -n $name -s 3 $BASEDIR/pod/3/$l/$file $BASEDIR/$POD/man/$l/man3/$name.3
					fi
				done
			fi
			if [ -n "$POD5FILES" ]; then
				for file in $POD5FILES; do
					LOCAL=`basename $file`
					if [ -f $BASEDIR/pod/5/$l/$LOCAL ]; then
						# TRANSLATORS: $l contains language code, $file contains the basename of the POD file
						eval_gettext "Processing \$l translations for \$file (5). . ."; echo
						# shorten names that already contain the 5.
						SHORT=`echo $LOCAL|cut -d'5' -f1|sed -e 's/\.$//'`
						if [ -n "$SHORT" ]; then
							pod2man --utf8 -s 5 $BASEDIR/pod/5/$l/$LOCAL $BASEDIR/$POD/man/$l/man5/${SHORT}.5
						else
							pod2man --utf8 -s 5 $BASEDIR/pod/5/$l/$LOCAL $BASEDIR/$POD/man/$l/man5/$LOCAL.5
						fi
					fi
				done
			fi
			if [ -n "$POD7FILES" ]; then
				for file in $POD7FILES; do
					LOCAL=`basename $file`
					if [ -f $BASEDIR/pod/7/$l/$LOCAL ]; then
						# TRANSLATORS: $l contains language code, $file contains the basename of the POD file
						eval_gettext "Processing \$l translations for \$file (7). . ."; echo
						# shorten names that already contain the 7.
						SHORT=`echo $LOCAL|cut -d'7' -f1|sed -e 's/\.$//'`
						if [ -n "$SHORT" ]; then
							pod2man --utf8 -s 7 $BASEDIR/pod/7/$l/$LOCAL $BASEDIR/$POD/man/$l/man7/${SHORT}.7
						else
							pod2man --utf8 -s 7 $BASEDIR/pod/7/$l/$LOCAL $BASEDIR/$POD/man/$l/man7/$LOCAL.7
						fi
					fi
				done
			fi
		done
		if [ -n "$HTMLDIR" ]; then
			mkdir -p $BASEDIR/$d/$HTMLDIR/$l/
			xsltproc -o $BASEDIR/$d/$HTMLDIR/$l/ --nonet $HTMLXSL $XMLDIR/$l/$HTMLFILE
		fi
		done
		if [ -n "$HTMLDIR" ]; then
			for i in `ls $BASEDIR/$d/$HTMLDIR/*.html`; do
				iconv -t utf-8 -f iso8859-1 $i > $BASEDIR/$HTMLDIR/tmp
				sed < $BASEDIR/$HTMLDIR/tmp > $i -e 's:charset=ISO-8859-1:charset=UTF-8:'
			done
		fi
	if [ -n "$HTMLDIR" ]; then
		rm -f $BASEDIR/$HTMLDIR/tmp
	fi
done

for l in $LANGS; do
	rm -rf $XMLDIR/$l
done
rm -rf $BASEDIR/pod/