summarylogtreecommitdiffstats
path: root/ksh.install
diff options
context:
space:
mode:
authorChris Severance2015-07-06 20:36:35 -0400
committerChris Severance2015-07-06 20:36:35 -0400
commit48d405978d78fdd35119b0bf1aba5ecfd510c053 (patch)
tree019b424b5b966ef6bdc1f9546ae8d71b196e9df8 /ksh.install
downloadaur-48d405978d78fdd35119b0bf1aba5ecfd510c053.tar.gz
Initial import
Diffstat (limited to 'ksh.install')
-rw-r--r--ksh.install45
1 files changed, 45 insertions, 0 deletions
diff --git a/ksh.install b/ksh.install
new file mode 100644
index 000000000000..8abd5acbcd79
--- /dev/null
+++ b/ksh.install
@@ -0,0 +1,45 @@
+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 '/bin/ksh' >> '/etc/shells'
+ mandb -q
+}
+
+pre_upgrade() {
+ :
+}
+
+post_upgrade() {
+ post_install
+}
+
+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'
+ fi
+ sed -i -e '/^\/bin\/ksh$/d' '/etc/shells'
+}
+
+post_remove() {
+ mandb -q
+ # /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
+}