- pushd ${BUILDROOT}/usr/share/man
- for manpage in man*/*; do
- if [ -L ${manpage} ]; then
- TARGET=`ls -l ${manpage} | awk '{ print $NF }'`
- ln -snf ${TARGET}ssl ${manpage}ssl
- rm -f ${manpage}
- else
- mv ${manpage} ${manpage}ssl
- fi
+ pushd %{BUILDROOT}%{mandir}
+ for m in $(find . -type f | xargs grep -L '#include'); do
+ d="${m%/*}"
+ d="${d#./}"
+ m="${m##*/}"
+ [[ ${m} == openssl.1* ]] && continue
+ [[ -n "$(find -L "${d}" -type l)" ]] && exit 1
+ mv ${d}/{,ssl-}${m}
+
+ # fix up references to renamed man pages
+ sed -i '/^[.]SH "SEE ALSO"/,/^[.]/s:\([^(, ]*(1)\):ssl-\1:g' "${d}/ssl-${m}"
+ ln -s "ssl-${m}" "${d}/openssl-${m}"
+
+ # locate any symlinks that point to this man page ... we assume
+ # that any broken links are due to the above renaming
+ for s in $(find -L "${d}" -type l); do
+ s="${s##*/}"
+ rm -f "${d}/${s}"
+ ln -s "ssl-${m}" "${d}/ssl-${s}"
+ ln -s "ssl-${s}" "${d}/openssl-${s}"
+ done