blob: 465ac73a051ad3533cd1656e19c0cee95eaeb585 (
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
35
36
37
38
39
40
41
|
pre_install() {
:
}
post_install() {
for _ksh in ksh ksh93 rksh rksh93; do
grep -qle "^/bin/${_ksh}$" /etc/shells || echo "/bin/${_ksh}" >> '/etc/shells'
grep -qle "^/usr/bin/${_ksh}$" /etc/shells || echo "/usr/bin/${_ksh}" >> '/etc/shells'
done
}
pre_upgrade() {
:
}
post_upgrade() {
post_install
}
pre_remove() {
for _ksh in ksh ksh93 rksh rksh93; 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
for _ksh in ksh ksh93 rksh rksh93; 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
}
|