Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwcastillo/727d52c4fe445bba67e850dd9cefe74d to your computer and use it in GitHub Desktop.
Save jwcastillo/727d52c4fe445bba67e850dd9cefe74d to your computer and use it in GitHub Desktop.
Install oh-my-zsh on openwrt/lede-project

Install oh-my-zsh on OpenWrt

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

Prevent User Lockout

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment