LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File ksh93.install of Package ksh93-git (Project home:Head_on_a_Stick:Arch)

pre_install() {

post_install() {
  # I think we should use /usr/bin/ksh but the other except zsh shells show /bin
  grep -qle '/bin/ksh$' '/etc/shells' || echo $'/usr/bin/ksh\n/bin/ksh' >> '/etc/shells'

pre_upgrade() {

post_upgrade() {

pre_remove() {
  # This is only necessary on alternate shells. sh and bash 
  # are at the base of Arch and cannot be removed.
  # To test this you should have a spare root shell already open.
  # Otherwise, if this doesn't work, you will need to learn how to bypass
  # the default shell on login.
  # http://stackoverflow.com/questions/11059067/what-is-the-nix-command-to-view-a-users-default-login-shell
  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 root access.'
   echo '**********************************************'
   # sh is more likely to guarantee a login than bash because sh is typically
   # unmodified. Crappy, but guaranteed.
   chsh -s '/bin/sh'
  sed -i -e '/^\/bin\/ksh$/d' -e '/^\/usr\/bin\/ksh$/d' '/etc/shells'

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.'