| 1 |
#!/bin/sh |
| 2 |
# |
| 3 |
# Copyright © 2010-2019 Dr. Tobias Quathamer <[email protected]> |
| 4 |
# © 2025 Dr. Helge Kreutzmann <[email protected]> |
| 5 |
# |
| 6 |
# This program is free software: you can redistribute it and/or modify |
| 7 |
# it under the terms of the GNU General Public License as published by |
| 8 |
# the Free Software Foundation, either version 3 of the License, or |
| 9 |
# (at your option) any later version. |
| 10 |
# |
| 11 |
# This program is distributed in the hope that it will be useful, |
| 12 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
# GNU General Public License for more details. |
| 15 |
# |
| 16 |
# You should have received a copy of the GNU General Public License |
| 17 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 |
|
| 19 |
# Start with clean directories and no leftover links.txt |
| 20 |
rm -rf man* links.txt |
| 21 |
|
| 22 |
mkdir man1 man2 man3 man4 man5 man6 man7 man8 |
| 23 |
|
| 24 |
# Process packages |
| 25 |
while read package; do |
| 26 |
mkdir tmp |
| 27 |
|
| 28 |
# Download HTML page and discover the correct link |
| 29 |
echo -n "Downloading and updating package '$package'" |
| 30 |
url="" |
| 31 |
while [ -z "$url" ]; do |
| 32 |
url=$(wget --quiet -O - "http://packages.debian.org/sid/amd64/$package/download" | |
| 33 |
grep "http://ftp.de.debian.org/debian/pool/" | |
| 34 |
sed -e "s,.*\(http://ftp.de.debian.org/debian/pool/[^\"]*\).*,\1,") |
| 35 |
echo -n "." |
| 36 |
done |
| 37 |
echo |
| 38 |
|
| 39 |
# Update the manpages from the package |
| 40 |
wget -t 40 --quiet --directory-prefix=tmp/downloads "$url" |
| 41 |
latest_deb=$(ls tmp/downloads/$package\_*.deb) |
| 42 |
if [ -z $latest_deb ]; then |
| 43 |
echo "Warning: Could not find .deb for package '$package'" |
| 44 |
else |
| 45 |
data_tar=$(ar t $latest_deb | grep data.tar) |
| 46 |
ar x $latest_deb $data_tar |
| 47 |
tar xaf $data_tar --directory=tmp 2>/dev/null |
| 48 |
./move-manpages.sh |
| 49 |
fi |
| 50 |
# Finally, remove the tarball, so that the regexp |
| 51 |
# matching does not match the wrong tarball. |
| 52 |
# See pacman and pacman-contrib for an example. |
| 53 |
rm -rf tmp data.tar.* |
| 54 |
done < packages.txt |
| 55 |
|
| 56 |
if [ -f links.txt ]; then |
| 57 |
LC_ALL=C sort links.txt > tmp.links |
| 58 |
mv tmp.links links.txt |
| 59 |
fi |
| 60 |
|
| 61 |
# Special case for grub-mknetdir.1. This file contains an unprintable |
| 62 |
# character (detected as "\v") which po4a can't handle. |
| 63 |
# See https://savannah.gnu.org/bugs/?58936 |
| 64 |
if [ -f ./man1/grub-mknetdir.1 ]; then |
| 65 |
sed -i -e "s|Prepares|Prepares|" ./man1/grub-mknetdir.1 |
| 66 |
fi |
| 67 |
|
| 68 |
# Remove some files due to licensing issues |
| 69 |
rm -f ./man1/hpcdtoppm.1 |
| 70 |
rm -f ./man1/zipgrep.1 |