PREUN
/bin/sh
if [ $1 = 0 ]; then
/usr/sbin/alternatives --remove ksh /bin/ksh93
fi
POSTIN
/bin/sh
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
/usr/sbin/alternatives --install /bin/ksh ksh \
/bin/ksh93 50 \
--slave /usr/bin/ksh ksh-usrbin \
/bin/ksh93 \
--slave /usr/share/man/man1/ksh.1.gz ksh-man \
/usr/share/man/man1/ksh93.1.gz
#if not symlink we are updating ksh where there was no alternatives before
#so replace with symlink and set alternatives
if [ ! -L /bin/ksh ]; then
/usr/sbin/alternatives --auto ksh
ln -sf /etc/alternatives/ksh /bin/ksh
ln -sf /etc/alternatives/ksh-usrbin /usr/bin/ksh
ln -sf /etc/alternatives/ksh-man /usr/share/man/man1/ksh.1.gz
fi
POSTUN
/bin/sh
if [ ! -f /bin/ksh ]; then
grep -v '^/bin/ksh$' /etc/shells >/etc/shells.new
mv /etc/shells.new /etc/shells
chmod 644 /etc/shells
fi