#!/bin/bash # # Collect .pot files from a set of source packages and place them in # a specified output directory. # outdir=$1 shift if [ -z "$outdir" ] ; then echo usage: `basename $0` output_directory sourcerpm '[...]' exit 1 fi tmpdir=`mktemp -d ${TMPDIR:-/tmp}/collect-potfilesXXXXXX` if [ -z "$tmpdir" ] ; then echo error creating tmpdir exit 1 fi exec < /dev/null cleanup() { rm -fr $tmpdir } trap cleanup PIPE INT KILL TERM for sourcepackage in $@ ; do rpm \ --define "_topdir $tmpdir" \ --define "_sourcedir $tmpdir" \ --define "_specdir $tmpdir" \ --define "_builddir $tmpdir" \ --define "_srpmdir $tmpdir" \ --define "_rpmdir $tmpdir" \ -U $sourcepackage > /dev/null 2> /dev/null && rpmbuild \ --define "_topdir $tmpdir" \ --define "_sourcedir $tmpdir" \ --define "_specdir $tmpdir" \ --define "_builddir $tmpdir" \ --define "_srpmdir $tmpdir" \ --define "_rpmdir $tmpdir" \ -bp $tmpdir/*.spec > /dev/null 2> /dev/null for potfile in `find $tmpdir -name "*.pot"`; do basename $potfile cp -f $potfile $outdir/ done chmod -R u+rw $tmpdir/* rm -fr $tmpdir/* done cleanup