53 lines
1.3 KiB
Bash
53 lines
1.3 KiB
Bash
PatchManpath() {
|
|
TIMESTAMP=`date "+%Y%m%d-%k_%M_%S"`
|
|
retval=0
|
|
manconf_path="/etc/man.conf"
|
|
manpath_path="/etc/manpath.config"
|
|
mancf_path="/usr/share/man.cf"
|
|
manconfig_path="/etc/man.config"
|
|
mandbconf_path="/etc/man_db.conf"
|
|
manpath_str="MANDATORY_MANPATH $PREFIX/man"
|
|
manconf_str="MANPATH $PREFIX/man"
|
|
if [ -x "`which manpath`" ] ; then
|
|
manpath=`which manpath`
|
|
else
|
|
#only solaris haven't manpath
|
|
[ -f "$mancf_path" ] && manpath="echo `$GREP MANPATH $mancf_path`"
|
|
fi
|
|
if [ -d "$PREFIX/man" -a -z "`$manpath 2>/dev/null | $GREP $PREFIX/man`" ] ; then
|
|
for f in "$manpath_path" "$manconf_path" "$mancf_path" "$manconfig_path" "$mandbconf_path" ; do
|
|
if [ -f "$f" ] ; then
|
|
man_str="$manconf_str"
|
|
case "$f" in
|
|
"$manconf_path")
|
|
man_conf="$manconf_path"
|
|
;;
|
|
"$manpath_path")
|
|
man_conf="$manpath_path"
|
|
man_str="$manpath_str"
|
|
;;
|
|
"$mancf_path")
|
|
man_conf="$mancf_path"
|
|
;;
|
|
"$manconfig_path")
|
|
man_conf="$manconfig_path"
|
|
;;
|
|
"$mandbconf_path")
|
|
man_conf="$mandbconf_path"
|
|
man_str="$manpath_str"
|
|
;;
|
|
esac
|
|
if [ -z "`$GREP "$PREFIX/man" "$man_conf" 2>/dev/null`" ] ; then
|
|
cp -p "$man_conf" "$man_conf.$TIMESTAMP"
|
|
echo "$man_str" >> "$man_conf"
|
|
retval=$?
|
|
break
|
|
fi
|
|
else
|
|
retval=1
|
|
fi
|
|
done
|
|
fi
|
|
return $retval
|
|
}
|