Install Requirements Packages
opkg update && opkg install ca-certificates zsh curl git-http
Install oh-my-zsh
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Set zsh as default (thanks to @mlouielu)
which zsh && sed -i -- 's:/bin/ash:'`which zsh`':g' /etc/passwd
To prevent lock-outs after accidentially removing zsh(as explained in the wiki) you can add a check for zsh
and fallback to ash
in /etc/rc.local
(thanks to @fox34):
# Revert root shell to ash if zsh is not available
if grep -q '^root:.*:/usr/bin/zsh$' /etc/passwd && [ ! -x /usr/bin/zsh ]; then
# zsh is root shell, but zsh was not found or not executable: revert to default ash
[ -x /usr/bin/logger ] && /usr/bin/logger -s "Reverting root shell to ash, as zsh was not found on the system"
sed -i -- 's:/usr/bin/zsh:/bin/ash:g' /etc/passwd
fi
I just get connection refused if I try telnet. I ended up taking a backup, editing /etc/passwd to put ash back as shell, then restored from that.
I don't quite understand how changing the shell in /etc/passwd, then deleting /etc/passwd, gets it to use zsh. The only place the choice of zsh is stored is in /etc/passwd. Or does the OS make a backup of it?