Changing shell in a Veewee script

179 views Asked by At

I'm in the process of building out my first Vagrant box using Veewee (ubuntu 12.04) and, about 95% of the way there, I'm stuck on something. I have a custom post-install script, called right after postinstall.sh, that builds out my preferred user environment. It...

  • Installs curl, zsh & git
  • Installs oh-my-zsh
  • Writes a custom theme file
  • Writes a custom .zshrc file

All of that seems to be fine, but the next logical step is to change my shell so that it's all ready to go when I vagrant ssh for the first time, but I'm stuck. The last line of this script is chsh -s /usr/bin/zsh, but it doesn't take. Am I doing something wrong? Is there another way of changing the shell from the script? I suppose I could update /etc/passwd with sed, but...ugh. Be nice if it could be done in a cleaner way than that.

Also, while trying to run down this issue, I discovered another possible issue. I don't have passwordless sudo access. In the packaged postinstall.sh script, I see that it's running set to make that happen, but in 12.04, at least, /etc/sudoers is read-only which probably prevents the change from getting made.

Anyone else noticed these things? Any hints on how to work around them? My searches have turned up nothing.

Thanks.

1

There are 1 answers

0
opyate On

This worked for me whilst installing Ubuntu 12.04.3 with Vagrant (aka "precise32"): since the default vagrant password is just "vagrant":

echo "vagrant" | chsh -s /bin/zsh