summarylogtreecommitdiffstats
path: root/ksh93.install
blob: 2f098b9162efed54e11bd59327cf90c8c518334e (plain)
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
pre_install() {
  :
}

post_install() {
  grep -qle '/bin/ksh$' '/etc/shells' || echo $'/usr/bin/ksh\n/bin/ksh' >> '/etc/shells'
}

pre_upgrade() {
  :
}

post_upgrade() {
  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'
}

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
}