summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--abuild.in27
1 files changed, 24 insertions, 3 deletions
diff --git a/abuild.in b/abuild.in
index f5cc17c..b8d8851 100644
--- a/abuild.in
+++ b/abuild.in
@@ -1438,9 +1438,30 @@ default_doc() {
done
# compress man pages
- find "$subpkgdir"/usr/share/man/*[1-9] \
- -type f \! -name \*.gz \! -name \*.bz2 2>/dev/null |
- xargs -r gzip -9
+ local previnode= prevname= mandir="$subpkgdir"/usr/share/man
+ [ -d "$mandir" ] && find "$subpkgdir"/usr/share/man \
+ -type f \( -name \*.[0-9n] -o -name \*.[0-9][a-z]* \) \
+ -exec stat -c "%i %n" {} \; | sort -n \
+ | while read inode name; do
+
+ if [ "$inode" = "$previnode" ]; then
+ # update hard link
+ rm "$name"
+ ln "$prevname".gz "$name".gz
+ else
+ gzip -9 "$name"
+ fi
+
+ previnode="$inode"
+ prevname="$name"
+ done
+ [ -d "$mandir" ] && find "$subpkgdir"/usr/share/man \
+ -type l \( -name \*.[0-9n] -o -name \*.[0-9][a-z]* \) \
+ | while read symlink; do
+
+ ln -s $(readlink $symlink).gz "$symlink".gz
+ rm "$symlink"
+ done
rm -f "$subpkgdir/usr/share/info/dir"