diff options
Diffstat (limited to 'ksh93.install')
-rw-r--r-- | ksh93.install | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/ksh93.install b/ksh93.install index 2f098b9162ef..8ac52c373642 100644 --- a/ksh93.install +++ b/ksh93.install @@ -1,34 +1,40 @@ pre_install() { - : + : } post_install() { - grep -qle '/bin/ksh$' '/etc/shells' || echo $'/usr/bin/ksh\n/bin/ksh' >> '/etc/shells' + grep -qle '/bin/ksh$' '/etc/shells' || echo $'/usr/bin/ksh\n/bin/ksh' >> '/etc/shells' + grep -qle '/bin/ksh93$' '/etc/shells' || echo $'/usr/bin/ksh93\n/bin/ksh93' >> '/etc/shells' + grep -qle '/bin/rksh$' '/etc/shells' || echo $'/usr/bin/rksh\n/bin/rksh' >> '/etc/shells' } pre_upgrade() { - : + : } post_upgrade() { - post_install + post_install } pre_remove() { - if getent passwd root | cut -d: -f7 | grep -qle '/bin/ksh'; then - echo '**************************************************' - echo '*** Warning: root has ksh as the login shell.' - echo '*** Shell changed to sh to prevent loss of access.' - echo '**************************************************' - chsh -s '/bin/sh' - fi - sed -i -e '/^\/bin\/ksh$/d' -e '/^\/usr\/bin\/ksh$/d' '/etc/shells' + for _ksh in ksh ksh93 rksh; do + if getent passwd root | cut -d: -f7 | grep -qle "/bin/${_ksh}"; then + echo "**************************************************" + echo "*** Warning: root has ${_ksh} as the login shell." + echo "*** Shell changed to sh to prevent loss of access." + echo "**************************************************" + chsh -s '/bin/sh' + fi + sed -i -e '/^\/bin\/'"${_ksh}"'$/d' -e '/^\/usr\/bin\/'"${_ksh}"'$/d' '/etc/shells' + done } post_remove() { - # /usr/bin/ksh is also detected - if getent passwd | cut -d: -f7 | grep -qle '/bin/ksh'; then - echo '*** Warning: Some users have ksh as their login shell.' - echo '*** Fix promptly to restore access.' - fi + # /usr/bin/${_ksh} is also detected + for _ksh in ksh ksh93 rksh; do + if getent passwd | cut -d: -f7 | grep -qle "/bin/${_ksh}"; then + echo "*** Warning: Some users have ${_ksh} as their login shell." + echo "*** Fix promptly to restore access." + fi + done } |