create-authors-file.sh 1.89 KB
Newer Older
1 2
#!/bin/sh
#
3
# Copyright © 2012-2018 Dr. Tobias Quathamer <toddy@debian.org>
4 5 6 7 8 9 10 11 12 13 14 15 16 17
#
# 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/>.

18
# Generate AUTHORS file
19 20 21 22 23
echo "# Authors" > AUTHORS.md
echo >> AUTHORS.md
echo "The following people have contributed to the german translation" >> AUTHORS.md
echo "of Linux manpages. The list is sorted alphabetically." >> AUTHORS.md
echo >> AUTHORS.md
24 25

# Extract all translators from the copyright headers
26 27 28
files=$(find po/primary/man? -name "*po" | sort)
files="$files $(find po/secondary-*/man? -name "*po" | sort)"
for translation in $files; do
29 30
	# Use the header up until the first msgid
	# and remove the comment character
31
	translators=$(sed '/msgid/q;s/^#\s\+//' "$translation" |
32 33 34 35 36 37
	# Throw away the common (non translator) lines
	grep -v "German translation of manpages" |
	grep -v "This file is distributed under the same license as the manpages-de package." |
	grep -v "Copyright © of this file:" |
	grep -v "msgid" |
	# Split lines to extract the name (and e-mail address)
38
	cut -f1 -d",")
39 40 41
	# Save a list of all translators in a temporary file for copyright determination
	echo "$translators" >> translators.list
done
42 43 44
# Sort, unique, remove blank lines from file, and indent with an asterisk
sort translators.list | uniq | sed -e "/^$/d; s/^/* /" > tmp.list
cat tmp.list >> AUTHORS.md
45
rm tmp.list translators.list