blob: 5936051e6a8ab9830db4cc637d0e46aa33b07b3b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#!/bin/sh
# $FreeBSD$
LINK_USRBIN="%%LINK_USRBIN%%"
: ${OSVERSION:=`/sbin/sysctl -n kern.osreldate`};
PERL_VERSION="%%PERL_VERSION%%"
special_link_list="perl perl5"
do_remove_links()
{
for binary in ${special_link_list} ; do
if [ -L "/usr/bin/${binary}" ] ; then
/bin/rm -f "/usr/bin/${binary}"
fi
done
bins=`/bin/ls /usr/bin/*perl*5.* ${PKG_PREFIX}/bin/*perl*5.* 2>/dev/null`
for binary in ${bins} ; do
if [ -L "${binary}" ] ; then
echo "use.perl: Removing ${binary} installed by an older perl port"
/bin/rm -f "${binary}"
fi
done
}
do_create_links()
{
for binary in ${special_link_list} ; do
if [ -f "/usr/bin/${binary}" ] ; then
echo "use.perl: Backing up /usr/bin/${binary} as /usr/bin/${binary}.freebsd"
/bin/mv -f "/usr/bin/${binary}" "/usr/bin/${binary}.freebsd"
fi
if [ -e "/usr/bin/${binary}" ] ; then
echo "use.perl: /usr/bin/${binary} is still there, which should not happen"
elif [ -e "${PKG_PREFIX}/bin/perl${PERL_VERSION}" ] ; then
/bin/ln -sf "${PKG_PREFIX}/bin/perl${PERL_VERSION}" "/usr/bin/${binary}"
else
echo "use.perl: ${PKG_PREFIX}/bin/perl${PERL_VERSION} is not there, a symlink won't do any good"
fi
done
}
if [ "$2" = "POST-INSTALL" ] ; then
if [ ${LINK_USRBIN} = yes ] ; then
do_remove_links
do_create_links
fi
elif [ "$2" = "POST-DEINSTALL" ] ; then
[ ${LINK_USRBIN} = yes ] && do_remove_links
fi
exit 0
|