2015-06-29 03:07:55 +02:00
|
|
|
#!/usr/bin/zsh
|
|
|
|
# We need to run this script in ZSH, so that switching user works!
|
|
|
|
NEW_USER=vagrant-omz
|
|
|
|
# Create User
|
|
|
|
PASSWORD='$6$OgLg9v2Z$Db38Jr9inZG7y8BzL8kqFK23fF5jZ7FU1oiIBLFjNYR9XVX03fwQayMgA6Rm1rzLbXaf.gkZaTWhB9pv5XLq11'
|
|
|
|
useradd -p $PASSWORD -g vagrant -s $(which zsh) -m $NEW_USER
|
|
|
|
echo "$NEW_USER ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/$NEW_USER
|
|
|
|
chmod 440 /etc/sudoers.d/$NEW_USER
|
|
|
|
|
|
|
|
(
|
|
|
|
# Change User (See http://unix.stackexchange.com/questions/86778/why-cant-we-execute-a-list-of-commands-as-different-user-without-sudo)
|
|
|
|
USERNAME=$NEW_USER
|
|
|
|
#UID=$(id -u $NEW_USER)
|
|
|
|
#EUID=$(id -u $NEW_USER)
|
|
|
|
HOME=/home/$NEW_USER
|
2015-07-07 20:08:06 +02:00
|
|
|
SHELL=$(which zsh)
|
2015-06-29 03:07:55 +02:00
|
|
|
|
2015-07-07 20:08:06 +02:00
|
|
|
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
|
2015-06-29 03:07:55 +02:00
|
|
|
|
|
|
|
mkdir -p ~/.oh-my-zsh/custom/themes
|
|
|
|
ln -s /vagrant_data ~/.oh-my-zsh/custom/themes/powerlevel9k
|
|
|
|
|
|
|
|
echo '
|
|
|
|
export ZSH=$HOME/.oh-my-zsh
|
|
|
|
ZSH_THEME="powerlevel9k/powerlevel9k"
|
2015-07-07 20:08:06 +02:00
|
|
|
plugins=(git rake ruby)
|
2015-06-29 03:07:55 +02:00
|
|
|
|
|
|
|
source $ZSH/oh-my-zsh.sh
|
2015-07-07 20:08:06 +02:00
|
|
|
' > $HOME/.zshrc
|
2015-06-29 03:07:55 +02:00
|
|
|
|
2017-03-21 02:43:24 +02:00
|
|
|
# setup environment
|
|
|
|
/vagrant_data/test-vm-providers/setup-environment.sh
|
2015-06-29 03:07:55 +02:00
|
|
|
)
|