From 1558ee68c796dfc1ba60cabb2fd28930a16afc0a Mon Sep 17 00:00:00 2001 From: gillchristian Date: Mon, 26 Nov 2018 14:53:31 +0100 Subject: [PATCH] Update installation scripts - Add vim 8 repository - Fix multiline command not working - docker: postinstall.sh -> install.sh - Some small fixes --- install.sh | 92 ++++++++++++++++++++++++++++---------------------- postinstall.sh | 60 +++++++++----------------------- readme.md | 5 +-- 3 files changed, 71 insertions(+), 86 deletions(-) diff --git a/install.sh b/install.sh index 0a291f6..b54a2f2 100755 --- a/install.sh +++ b/install.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash DOTFILES_DIR="$HOME/dev/dotfiles" @@ -11,47 +11,18 @@ function install_PACKAGES { sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys BBEBDCB318AD50EC6865090613B00F1FD2C19886 0DF731E45CE24F27EEEB1450EFDC8610341D9410 echo deb http://repository.spotify.com stable non-free | sudo tee /etc/apt/sources.list.d/spotify.list + # vim 8 repository + sudo add-apt-repository -y ppa:jonathonf/vim + sudo apt-get update echo "" echo "Installing packages" - sudo apt-get install -y \ - # general - zip \ - ubuntu-restricted-extras \ - unzip \ - rar \ - git \ - vim \ - vim-gnome \ - zsh \ - git-core \ - indicator-multiload \ - bison \ - curl \ - make \ - binutils \ - gcc \ - build-essential \ - terminator \ - xclip \ - silversearcher-ag \ - spotify-client \ - asciinema \ - jq \ - git-extras \ - tmux \ - # vim - cmake \ - python3-dev \ - python-dev \ - exuberant-ctags \ - mercurial \ - libmagic-dev \ - # docker - apt-transport-https \ - ca-certificates \ - software-properties-common + sudo apt-get install -y zip ubuntu-restricted-extras unzip rar git vim vim-gnome zsh git-core indicator-multiload + sudo apt-get install -y bison make binutils gcc build-essential terminator xclip silversearcher-ag asciinema mercurial + sudo apt-get install -y exuberant-ctags libmagic-dev apt-transport-https ca-certificates software-properties-common + sudo apt-get install -y curl jq git-extras tmux cmake python3-dev python-dev + sudo apt-get install -y --allow-unauthenticated spotify-client echo "" } @@ -89,6 +60,10 @@ function install_GOLANG { mkdir -p $GOPATH/src/github.com/$gitUsername fi + mkdir -p ~/dev/go + GOPATH="$HOME/dev/go" + export GO_BIN="$GOPATH/bin:/usr/local/go/bin" + goinstall "Find Unleashed" github.com/kbrgl/fu goinstall the_platinum_searcher github.com/monochromegane/the_platinum_searcher/... goinstall hub github.com/github/hub @@ -96,7 +71,7 @@ function install_GOLANG { goinstall gocloc github.com/hhatto/gocloc/cmd/gocloc goinstall gocode github.com/mdempsky/gocode - # only install td if fetching todos-data is succesful + # only install td if fetching todos-data is succesful # since it's a private repo, so only would work for me git clone git@github.com:gillchristian/todos-data.git ~/.todos if [ $? -eq 0 ]; then @@ -149,6 +124,41 @@ function install_ZSH { echo "" } +function install_DOCKER_COMPOSE { + # TODO: prompt version + echo "Installing docker-compose" + sudo touch /usr/local/bin/docker-compose + touch /tmp/docker-compose-binary + curl -L "https://github.com/docker/compose/releases/download/1.23.1/docker-compose-$(uname -s)-$(uname -m)" > /tmp/docker-compose-binary + sudo mv /tmp/docker-compose-binary /usr/local/bin/docker-compose + sudo chmod +x /usr/local/bin/docker-compose + echo "" +} + +function install_DOCKER { + echo "Installing Docker" + sudo apt-get remove docker docker-engine docker.io + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - + echo "Verifying fingerprint" + sudo apt-key fingerprint 0EBFCD88 + sudo add-apt-repository \ + "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) \ + stable" + sudo apt-get update + sudo apt-get install docker-ce + echo "Verifying Docker installation" + sudo docker run hello-world + sudo groupadd docker + sudo usermod -aG docker $USER + sudo systemctl enable docker + + install_DOCKER_COMPOSE + + echo "After the installation restart the computer and run \`\$ docker run hello-world\`" + echo "" +} + function install_CONFIG { install_ZSH @@ -162,10 +172,12 @@ function install_CONFIG { install_VIM install_GOLANG - + install_RUST install_HASKELL + + install_DOCKER } function main { diff --git a/postinstall.sh b/postinstall.sh index a15a705..d36dc42 100755 --- a/postinstall.sh +++ b/postinstall.sh @@ -6,8 +6,8 @@ source "$DOTFILES_DIR/helpers.sh" function install_NODE_ENV { echo "Installing node, nvm & yarn" - nvm install 8 - nvm alias default 8 + nvm install 8.9.4 + nvm alias default 8.9.4 curl -o- -L https://yarnpkg.com/install.sh | bash # yarn adds itself to the $PATH when being installed # but yarn path is already exported in ~/.zsh/exports.zsh @@ -17,8 +17,8 @@ function install_NODE_ENV { } function install_VIM_PLUGINS { - # only run if npm is installed - if hash npm 2>/dev/null; then + # only run if yarn & npm are installed + if hash npm 2>/dev/null && hash yarn 2>/dev/null; then echo "Installing vim plugins" vim +PlugInstall +qall # fzf adds a a call to source fzf to the ~/.zshrc, since it's already in @@ -31,12 +31,12 @@ function install_VIM_PLUGINS { cd ~/.vim/bundle/YouCompleteMe ./install.py --gocode-completer --tern-completer --clang-completer --rust-completer cd ~/.vim/bundle/tern_for_vim - npm install - npm install -g typescript livedown + yarn + yarn global add typescript livedown echo "" echo "Installing vim-elm dependencies" - npm install -g elm elm-test elm-oracle elm-format + yarn global add elm elm-test elm-oracle elm-format echo "" echo "Installing nerd-fonts" @@ -48,52 +48,22 @@ function install_VIM_PLUGINS { # TODO: move this from here, it's not vim related echo "Installing other programs from npm" - npm install -g tldr npm-ls-scripts + yarn global add tldr npm-ls-scripts + echo "" + + echo "Installing vim-go dependencies" + vim +GoInstallBinaries +qall echo "" else echo "In order to install vim packages you first need node & npm installed" fi } -function install_DOCKER_COMPOSE { - echo "Installing docker-compose" - sudo touch /usr/local/bin/docker-compose - sudo chmod +x /usr/local/bin/docker-compose - touch /temp/docker-compose-binary - curl -L "https://github.com/docker/compose/releases/download/1.16.1/docker-compose-$(uname -s)-$(uname -m)" > /temp/docker-compose-binary - sudo mv /temp/docker-compose-binary /usr/local/bin/docker-compose - echo "" -} - -function install_DOCKER { - echo "Installing Docker" - sudo apt-get remove docker docker-engine docker.io - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - - echo "Verifying fingerprint" - sudo apt-key fingerprint 0EBFCD88 - sudo add-apt-repository \ - "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ - $(lsb_release -cs) \ - stable" - sudo apt-get update - sudo apt-get install docker-ce - echo "Verifying Docker installation" - sudo docker run hello-world - sudo groupadd docker - sudo usermod -aG docker $USER - sudo systemctl enable docker - - install_DOCKER_COMPOSE - - echo "After the installation restart the computer and run \`\$ docker run hello-world\`" - echo "" -} - function main { install_NODE_ENV - install_VIM_PLUGINS - install_DOCKER + install_VIM_PLUGINS + # after calling sed to remove something from the # file that is symlinked the symlink gets broken echo "Relinking ~/.zsrc" @@ -101,3 +71,5 @@ function main { echo "All done!" echo "" } + +main diff --git a/readme.md b/readme.md index 67e3138..060f9a4 100644 --- a/readme.md +++ b/readme.md @@ -1,7 +1,7 @@ # my dotfiles ```bash -$ sudo apt-get git +$ sudo apt-get install git $ git clone https://github.com/gillchristian/dotfiles.git ~/dev/dotfiles $ cd ~/dev/dotfiles $ ./install.sh @@ -19,7 +19,8 @@ $ ./postinstall.sh - Test (_maybe inside a Docker container_). - Report of what went well and what not. - Improve output & progress. -- Unify `install.sh` and `postinstall.sh` in one script. +- Unify `install.sh` and `postinstall.sh` in one script (not not possible + because `nvm` is installing by zsh plugin when running zsh for the first time). ## Inspiration