Changeset View
Changeset View
Standalone View
Standalone View
lang/perl5.20/files/use.perl.in
#!/bin/sh | #!/bin/sh | ||||
# $FreeBSD$ | # $FreeBSD$ | ||||
: ${OSVERSION:=`/sbin/sysctl -n kern.osreldate`}; | : ${OSVERSION:=`/sbin/sysctl -n kern.osreldate`}; | ||||
PERL_VERSION="%%PERL_VERSION%%" | PERL_VERSION="%%PERL_VERSION%%" | ||||
PERL_VER="%%PERL_VER%%" | |||||
banner="# added by use.perl $(/bin/date +'%F %T')" | banner="# added by use.perl $(/bin/date +'%F %T')" | ||||
special_link_list="perl perl5" | special_link_list="perl perl5" | ||||
do_cleanup_manpath() | do_cleanup_manpath() | ||||
{ | { | ||||
if [ -f /etc/manpath.config ] ; then | if [ -f /etc/manpath.config ] ; then | ||||
/bin/cp -p /etc/manpath.config /etc/manpath.config.new | /bin/cp -p /etc/manpath.config /etc/manpath.config.new | ||||
/usr/bin/awk 's=0; | /usr/bin/awk 's=0; | ||||
/^#.*use.perl/ { s=1; mode=1 } | /^#.*use.perl/ { s=1; mode=1 } | ||||
/^#/ { s=1; if (mode != 1) { mode=0 } } | /^#/ { s=1; if (mode != 1) { mode=0 } } | ||||
/^OPTIONAL_MANPATH.*perl5/ { s=1; if (mode == 1) { mode=2 } } | /^OPTIONAL_MANPATH.*perl5/ { s=1; if (mode == 1) { mode=2 } } | ||||
/^$/ { s=1; if (mode != 2) { mode = 0 } } | /^$/ { s=1; if (mode != 2) { mode = 0 } } | ||||
{ if (s != 1) { mode = 0 } if (mode == 0) print }' /etc/manpath.config >/etc/manpath.config.new | { if (s != 1) { mode = 0 } if (mode == 0) print }' /etc/manpath.config >/etc/manpath.config.new | ||||
/bin/mv /etc/manpath.config /etc/manpath.config.bak | /bin/mv /etc/manpath.config /etc/manpath.config.bak | ||||
/bin/mv /etc/manpath.config.new /etc/manpath.config | /bin/mv /etc/manpath.config.new /etc/manpath.config | ||||
/bin/rm /etc/manpath.config.bak | /bin/rm /etc/manpath.config.bak | ||||
fi | fi | ||||
} | } | ||||
do_spam_manpath() | do_spam_manpath() | ||||
{ | { | ||||
if [ -f /etc/manpath.config ] ; then | if [ -f /etc/manpath.config ] ; then | ||||
echo "${banner}" >>/etc/manpath.config | echo "${banner}" >>/etc/manpath.config | ||||
echo "OPTIONAL_MANPATH ${PKG_PREFIX}/lib/perl5/${PERL_VER}/man" >>/etc/manpath.config | echo "OPTIONAL_MANPATH ${PKG_PREFIX}/%%SITEMAN3PREFIX%%/man" >>/etc/manpath.config | ||||
echo "OPTIONAL_MANPATH ${PKG_PREFIX}/lib/perl5/${PERL_VER}/perl/man" >>/etc/manpath.config | echo "OPTIONAL_MANPATH ${PKG_PREFIX}/%%MAN3PREFIX%%/man" >>/etc/manpath.config | ||||
fi | fi | ||||
} | } | ||||
if [ "$2" = "POST-INSTALL" ] ; then | if [ "$2" = "POST-INSTALL" ] ; then | ||||
if [ "${OSVERSION}" -lt 900022 ] ; then | if [ "${OSVERSION}" -lt 900022 ] ; then | ||||
do_cleanup_manpath | do_cleanup_manpath | ||||
do_spam_manpath | do_spam_manpath | ||||
fi | fi | ||||
elif [ "$2" = "POST-DEINSTALL" ] ; then | elif [ "$2" = "POST-DEINSTALL" ] ; then | ||||
[ "${OSVERSION}" -lt 900022 ] && do_cleanup_manpath | [ "${OSVERSION}" -lt 900022 ] && do_cleanup_manpath | ||||
fi | fi | ||||
exit 0 | exit 0 |