makepkg: fix recreation of hardlinks to .gz manpages
4ed12ae
tightened up the logic to use only find, but ignored the fact
that since the manpage hard link names were no longer captured. They
were created as separate compressed manpages, rather than as hardlinks.
This also introduces a minor efficiency of deleting all hardlinks at
once and using proper iteration over an array rather than a string.
Note to anyone else touching this code: e2fsprogs and libpcap are useful
for testing this. If that changes in the future, you can use the below
bash to locate others:
IFS=$'\n' read -rd '' -a a < <(find /usr/share/man -type f \! -links 1)
pacman -Qqo "${a[@]}" | sort -u
I broke it!
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
This commit is contained in:
parent
d1e04c1b67
commit
4a02350ded
1 changed files with 6 additions and 5 deletions
|
@ -996,14 +996,15 @@ tidy_install() {
|
||||||
# check file still exists (potentially already compressed due to hardlink)
|
# check file still exists (potentially already compressed due to hardlink)
|
||||||
if [[ -f ${manpage} ]]; then
|
if [[ -f ${manpage} ]]; then
|
||||||
# find hard links and remove them
|
# find hard links and remove them
|
||||||
# the '|| true' part keeps the script from bailing if find returned an
|
# the '|| true' part keeps the script from bailing on the EOF returned
|
||||||
# error, such as when one of the man directories doesn't exist
|
# by read at the end of the find output
|
||||||
find "${MAN_DIRS[@]}" \! -name "$file" -samefile "$manpage" \
|
IFS=$'\n' read -rd '' -a hardlinks < \
|
||||||
-exec rm -f {} \; 2>/dev/null || true
|
<(find "${MAN_DIRS[@]}" \! -name "$file" -samefile "$manpage" 2>/dev/null) || true
|
||||||
|
rm -f "${hardlinks[@]}"
|
||||||
# compress the original
|
# compress the original
|
||||||
gzip -9 "$manpage"
|
gzip -9 "$manpage"
|
||||||
# recreate hard links removed earlier
|
# recreate hard links removed earlier
|
||||||
for hl in ${hardlinks}; do
|
for hl in "${hardlinks[@]}"; do
|
||||||
ln "${manpage}.gz" "${hl}.gz"
|
ln "${manpage}.gz" "${hl}.gz"
|
||||||
chmod 644 ${hl}.gz
|
chmod 644 ${hl}.gz
|
||||||
done
|
done
|
||||||
|
|
Loading…
Add table
Reference in a new issue