change the affected section to this:
#!/bin/bash
# by: orbisvicis
manpath=$(manpath -g)
# Set the bash delimiter
# Spaces are mandatory when creating the array so bash does not becore confused
IFS=:
pathArray=( $manpath )
unset IFS
# From the bash man-pages
# Allow patterns which match no files to expand to a null string rather than themselves
shopt -s nullglob
for path in "${pathArray[@]}"
do
# fixing the symlink issue: symlinks to directories will be considered empty. Undesirable if symlink points outside manpath
# Must also check that the new link value is not already part of the manpath, dont want to give swish++ duplicate paths
# requires readlink
if [[ -h $path ]];then echo -n "symlink: "
# This works here due to read order, might not work in other versions/shells
if [[ $manpath = *$(readlink -n --canonicalize $path)* ]];then echo -n "duplicate,ignored: " else echo -n "redirected to: " path=$(readlink -n --canonicalize $path)
fi
fi pathFull=$path"/man*/" pathGlob=($pathFull)
# verify that the directory exists and contains the /man*/ subdirectories
# Note that this will return a false (no subdirectories) for symlinks as they are treated as files
# *this can make a difference if the link is not included in the manpath
(( ${#pathGlob[*]} )) && pathStringExist+=$path":" || echo $path": no \"man*\" subdirectories"
# Note that now ${path[@]} holds all the elements that matches the glob
# This is useful for performing operations using ${path[@]}
#echo ${pathGlob[@]}
done
# Unset the nullglob option
shopt -u nullglob
if [[ -e /var/cache/man2html/ ]] && [[ -x /usr/bin/index++ ]];then
if [[ -e /var/cache/man2html/man2html.swish++.index ]];then
rm /var/cache/man2html/man2html.swish++.index* /var/cache/man2html/manindexh* /var/cache/man2html/whatish-*
fi
echo "see /usr/share/man2html for configuration options"
index++ --config-file=/usr/share/man2html/swish++.conf "${pathArrayExist[@]}"
echo "Done, recommend restarting webserver"
fi
change the affected section to this:
#!/bin/bash
# by: orbisvicis
manpath=$(manpath -g)
# Set the bash delimiter
# Spaces are mandatory when creating the array so bash does not becore confused
IFS=:
pathArray=( $manpath )
unset IFS
# From the bash man-pages
echo -n "symlink: "
echo -n "duplicate,ignored: "
else
echo -n "redirected to: "
path= $(readlink -n --canonicalize $path)
pathFull= $path"/ man*/"
pathGlob= ($pathFull) +=$path" :" || echo $path": no \"man*\" subdirectories"
# Allow patterns which match no files to expand to a null string rather than themselves
shopt -s nullglob
for path in "${pathArray[@]}"
do
# fixing the symlink issue: symlinks to directories will be considered empty. Undesirable if symlink points outside manpath
# Must also check that the new link value is not already part of the manpath, dont want to give swish++ duplicate paths
# requires readlink
if [[ -h $path ]];then
# This works here due to read order, might not work in other versions/shells
if [[ $manpath = *$(readlink -n --canonicalize $path)* ]];then
fi
fi
# verify that the directory exists and contains the /man*/ subdirectories
# Note that this will return a false (no subdirectories) for symlinks as they are treated as files
# *this can make a difference if the link is not included in the manpath
(( ${#pathGlob[*]} )) && pathStringExist
# Note that now ${path[@]} holds all the elements that matches the glob
# This is useful for performing operations using ${path[@]}
#echo ${pathGlob[@]}
done
# Unset the nullglob option
shopt -u nullglob
IFS=:
pathArrayExist=( $pathStringExist )
unset IFS
echo "${pathArrayExi st[@]}"
if [[ -e /var/cache/ man2html/ ]] && [[ -x /usr/bin/index++ ]];then man2html/ man2html. swish++ .index ]];then man2html/ man2html. swish++ .index* /var/cache/ man2html/ manindexh* /var/cache/ man2html/ whatish- *
if [[ -e /var/cache/
rm /var/cache/
fi
echo "see /usr/share/man2html for configuration options" file=/usr/ share/man2html/ swish++ .conf "${pathArrayExi st[@]}"
index++ --config-
echo "Done, recommend restarting webserver"
fi