aboutsummaryrefslogtreecommitdiff
path: root/compile/oksh.sh
blob: 1a44c0f7f34127f29853b09d1ab0119eed30b655 (plain) (blame)
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
#!/bin/sh
set -ex
codedir="$HOME/scm/pub"
okshdir="${codedir}/ibara-oksh"
if ! [ -d "$okshdir" ] ; then
	git clone https://github.com/ibara/oksh "$okshdir"
fi
cd "$okshdir"
git checkout oksh-7.6
./configure
make
sudo make install
cd -

if ! grep /usr/local/bin/oksh /etc/shells ; then
	sudo sh -c 'echo /usr/local/bin/oksh >> /etc/shells'
fi

if ! grep -qF 'export ENV=$HOME/.kshrc' ~/.profile; then
	echo 'export ENV=$HOME/.kshrc' >> ~/.profile
fi

set +x
if ! grep ^$(id -un) /etc/passwd | grep /usr/local/bin/oksh ; then
	printf "Change shell to oksh? [y]es/[n]o: "
	read -r resp
	if [ "$resp" = "y" ] ; then
		chsh -s /usr/local/bin/oksh
	fi
fi
set -x