PREUN
/bin/sh
if [ $1 = 0 ]; then
/usr/sbin/alternatives --remove ksh /bin/pdksh
fi
POSTIN
/bin/sh
if [ $1 = 2 ]; then #package update, correct previous configuration
if [ ! -f /usr/bin/pdksh ] && grep -q '^/usr/bin/pdksh$' /etc/shells ; then
sed -i -e '/^\/usr\/bin\/pdksh/ d' /etc/shells
fi
fi
if [ ! -f /etc/shells ]; then
echo "/bin/ksh" > /etc/shells
else
if ! grep -q '^/bin/ksh$' /etc/shells ; then
echo "/bin/ksh" >> /etc/shells
fi
fi
if ! grep -q '^/usr/bin/ksh$' /etc/shells ; then
echo "/usr/bin/ksh" >> /etc/shells
fi
if ! grep -q '^/bin/pdksh$' /etc/shells ; then
echo "/bin/pdksh" >> /etc/shells
fi
/usr/sbin/alternatives --install /bin/ksh ksh \
/bin/pdksh 10 \
--slave /usr/bin/ksh ksh-usrbin \
/bin/pdksh \
--slave /usr/share/man/man1/ksh.1.gz ksh-man \
/usr/share/man/man1/pdksh.1.gz
POSTUN
/bin/sh
if [ ! -f /bin/ksh ]; then
sed -i -e '/^\/bin\/ksh/ d' -e '/^\/usr\/bin\/ksh/ d' /etc/shells
-e '/^\/usr\/bin\/pdksh/ d' /etc/shells
fi
if [ ! -f /bin/pdksh ]; then
sed -i -e '/^\/bin\/pdksh/ d' /etc/shells
fi