masonwan
10/18/2014 - 10:36 PM

The shell script to run to set up the server.

A set of shell scripts to set up

set PATH $PATH '/apollo/env/envImprovement/bin'

function install-git
  echo 'Installing git'
  sudo yum install -y git
end

if not test -d $HOME
  echo 'Create home directory'
  sudo mkdir $HOME
  sudo chown menghsiw:amazon $HOME
  cd $HOME

  echo 'The workspace is at '$HOME'/workspace'
  mkdir $HOME/workspace
end

if not test -d $HOME/repos
  echo 'Download server setup package'
  mkdir $HOME/repos
  cd $HOME/repos

  if not type git > /dev/null
    install-git
  end

  git clone https://masonwan@bitbucket.org/masonwan/server-setup.git

  echo 'Set up fish config'
  mkdir -p $HOME/.config/fish
  ln -s $HOME/repos/server-setup/fish/config.fish $HOME/.config/fish/config.fish
  ln -s $HOME/repos/server-setup/fish/functions $HOME/.config/fish/functions

  mkdir -p $HOME/.config/fish/extra
  ln -s $HOME/repos/server-setup/fish/extra/fish_user_key_bindings.fish $HOME/.config/fish/extra/fish_user_key_bindings.fish
  ln -s $HOME/repos/server-setup/fish/extra/amazon.fish $HOME/.config/fish/extra/amazon.fish
  ln -s $HOME/repos/server-setup/fish/extra/envImprovement.fish $HOME/.config/fish/extra/envImprovement.fish

  . $HOME/repos/server-setup/fish/config.fish
end

if not test -f $HOME/.vimrc
  echo 'Link vim config'
  ln -s $HOME/repos/server-setup/vim/.vimrc $HOME/.vimrc
end
# See https://github.com/fish-shell/fish-shell#packages-for-linux
sudo apt-add-repository ppa:fish-shell/release-3
sudo apt update
sudo apt install fish
# https://github.com/jorgebucaran/fisher#installation 
curl https://git.io/fisher --create-dirs -sLo ~/.config/fish/functions/fisher.fish
fisher -v
fisher add masonwan/fish-config
fisher add rafaelrinaldi/pure
fisher add jorgebucaran/fish-nvm
nvm use lts
echo "node version: "(node -v)
npm i -g npm@latest
function install-git
  echo 'Installing git'
  sudo apt-get install -y git
end

if not test -d $HOME
  echo 'Create home directory'
  sudo mkdir $HOME
  sudo chown menghsiw:amazon $HOME
  cd $HOME
end

if not test -d $HOME/repos
  echo 'Download server setup package'
  mkdir $HOME/repos
  cd $HOME/repos

  if not type git > /dev/null
    echo 'Could not find git command. Installing it.'
    install-git
  end

  git clone https://masonwan@bitbucket.org/masonwan/server-setup.git

  echo 'Set up fish config'
  mkdir -p $HOME/.config/fish
  ln -s $HOME/repos/server-setup/fish/config.fish $HOME/.config/fish/config.fish
  ln -s $HOME/repos/server-setup/fish/functions $HOME/.config/fish/functions

  mkdir -p $HOME/.config/fish/extra
  ln -s $HOME/repos/server-setup/fish/extra/fish_user_key_bindings.fish $HOME/.config/fish/extra/fish_user_key_bindings.fish

  . $HOME/repos/server-setup/fish/config.fish
end

if not test -f $HOME/.vimrc
  echo 'Link vim config'
  ln -s $HOME/repos/server-setup/vim/.vimrc $HOME/.vimrc
end