From b93ff2005476c814219e889b0a89e7258b27e6b7 Mon Sep 17 00:00:00 2001 From: MorganGeek Date: Sun, 1 Dec 2019 17:21:08 +0100 Subject: [PATCH] fix shellchecks warnings + stop using brew in Linux --- centos.sh | 62 ++++++++++++++++++++++++++++++++++------ dot_scripts/bootstrap.sh | 40 +++++++++++++------------- dot_scripts/reload.sh | 10 ++++++- dot_scripts/upgrade.sh | 15 +++++++--- 4 files changed, 94 insertions(+), 33 deletions(-) diff --git a/centos.sh b/centos.sh index dee453d..6a55415 100644 --- a/centos.sh +++ b/centos.sh @@ -1,6 +1,5 @@ #!/usr/bin/env bash -cask "java" -cask "iterm2" +#cask "iterm2" curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh /dev/stdin yum -y install https://zoom.us/client/latest/zoom_x86_64.rpm @@ -38,10 +37,10 @@ yum -y install firefox # clone git clone https://github.com/powerline/fonts.git --depth=1 # install -cd fonts +cd fonts || exit ./install.sh # clean-up a bit -cd .. +cd .. || exit rm -rf fonts # Install ZSH @@ -58,11 +57,11 @@ echo "export PATH=\"$GOPATH/bin:$PATH\"" >> ~/.zshrc # Install Hugo mkdir "$HOME/src" -cd "$HOME/src" +cd "$HOME/src" || exit git clone https://github.com/gohugoio/hugo.git -cd hugo +cd hugo || exit go install --tags extended -cd "$HOME" +cd "$HOME" || exit # Inet utils yum -y install telnet ftp rsh traceroute @@ -194,7 +193,7 @@ yum -y install nmon glances # Install Fuzzy finder git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf yes | ~/.fzf/install -exec "$SHELL" +#exec "$SHELL" # Install diff-so-fancy curl https://raw.githubusercontent.com/so-fancy/diff-so-fancy/master/third_party/build_fatpack/diff-so-fancy > /usr/local/bin/diff-so-fancy && chmod +x /usr/local/bin/diff-so-fancy @@ -218,3 +217,50 @@ yum -y install aspell aspell-en curl -o /etc/yum.repos.d/konimex-neofetch-epel-7.repo https://copr.fedorainfracloud.org/coprs/konimex/neofetch/repo/epel-7/konimex-neofetch-epel-7.repo # Install neofetch to display system info nicely yum -y install neofetch + +cargo install nu + +cat < /etc/yum.repos.d/kubernetes.repo +[kubernetes] +name=Kubernetes +baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64 +enabled=1 +gpgcheck=1 +repo_gpgcheck=1 +gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg +EOF + +yum install -y kubectl + + +# Install the harbottle-main repo +sudo yum -y install https://harbottle.gitlab.io/harbottle-main/7/x86_64/harbottle-main-release.rpm +yum -y install kubectx + +# Install packer +packer_version=1.4.5 +curl -L -o /tmp/packer.zip https://releases.hashicorp.com/packer/${packer_version}/packer_${packer_version}_linux_amd64.zip +cd /usr/local/bin && unzip -o /tmp/packer.zip && rm -f /tmp/packer.zip + +yum -y install weechat tflint + +curl -sSLO https://github.com/pinterest/ktlint/releases/download/0.35.0/ktlint && chmod a+x ktlint +# you can also download ktlint manually from https://github.com/pinterest/ktlint/releases +# another option is "brew install ktlint" + +# verify PGP signature (optional but recommended) +curl -sS https://keybase.io/pinterestandroid/pgp_keys.asc | gpg --import +curl -sSLO https://github.com/pinterest/ktlint/releases/download/0.35.0/ktlint.asc +gpg --verify ktlint.asc + +git clone https://github.com/getzola/zola.git +cd zola +cargo build --Release + +yum install -y https://github.com/vmware/octant/releases/download/v0.9.1/octant_0.9.1_Linux-64bit.rpm && yum clean all + +yum -y install bc +git clone https://github.com/fcambus/ansiweather.git + +git clone https://github.com/datawire/telepresence.git && cd telepresence +env PREFIX=/usr/local ./install.sh diff --git a/dot_scripts/bootstrap.sh b/dot_scripts/bootstrap.sh index c02cce2..4985452 100755 --- a/dot_scripts/bootstrap.sh +++ b/dot_scripts/bootstrap.sh @@ -3,7 +3,7 @@ echo "Hello $(whoami)! Let's get you set up." -echo "mkdir -p $(HOME)/Code" +echo "mkdir -p $HOME/Code" mkdir -p ~/Code ln -snf ~/Code/dotfiles/dot_scripts ~/.scripts chmod +x ~/.scripts/*.sh @@ -23,28 +23,15 @@ case "$(uname -s)" in Darwin) echo "(Mac OS X) installing homebrew" /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" - ;; - - Linux) - echo "(Linux) installing homebrew" - git clone https://github.com/Homebrew/brew ~/.linuxbrew/Homebrew - mkdir -p ~/.linuxbrew/bin - ln -snf ../Homebrew/bin/brew ~/.linuxbrew/bin - eval "$(~/.linuxbrew/bin/brew shellenv)" - ;; - *) - echo 'Homebrew installation aborted : Non supported OS' - exit + # Prevent `Error: Your Homebrew is outdated. Please run `brew update`.` + echo "Updating Homebrew" + brew update ;; esac -# Prevent `Error: Your Homebrew is outdated. Please run `brew update`.` -echo "Updating Homebrew" -brew update # Create symbolic links echo "Creating symbolic links" ln -snf ~/.local/share/chezmoi/ ~/dotfiles -ln -snf ~/Code/dotfiles/Brewfile ~/Brewfile ln -snf ~/Code/dotfiles/Gemfile ~/Gemfile ln -snf ~/Code/dotfiles/README.md ~/README.md ln -snf ~/Code/dotfiles/dot_bash_profile ~/.bash_profile @@ -75,8 +62,21 @@ case "$(uname -s)" in esac # Install dependencies (apps, fonts, ...) with Brew -echo "Brew installing stuff (apps, fonts, ...)" -brew bundle +case "$(uname -s)" in + Darwin) + echo "(Mac OS X) Brew installing stuff (apps, fonts, ...)" + ln -snf ~/Code/dotfiles/Brewfile ~/Brewfile + brew bundle + ;; +esac + +# Install dependencies (apps, fonts, ...) for CentOS +case "$(uname -s)" in + Linux) + echo "(CentOS) Installing stuff (apps, ...)" + ~/Code/dotfiles/centos.sh + ;; +esac # Switch to ZSH echo "switching to ZSH" @@ -125,7 +125,7 @@ ln -snf ~/Code/dotfiles/dot_zshrc.pre-oh-my-zsh ~/.zshrc.pre-oh-my-zsh echo "Installing Vundle + VIM Plugins" git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim -vim +PluginInstall +qall +vim +PluginInstall +qall > /dev/null #https://github.com/ycm-core/YouCompleteMe/blob/master/README.md#installation cd "$HOME/.vim/bundle/YouCompleteMe" || exit ./install.py --all diff --git a/dot_scripts/reload.sh b/dot_scripts/reload.sh index 5960dfa..a796db9 100755 --- a/dot_scripts/reload.sh +++ b/dot_scripts/reload.sh @@ -4,7 +4,15 @@ export SDKMAN_DIR="$HOME/.sdkman" chmod +x ~/.scripts/*.sh source ~/.zshrc sdk use java 8.0.222-zulu -brew bundle + +# Homebrew reloading stuff +case "$(uname -s)" in + Darwin) + echo "(Mac OS X) Homebrew reloading stuff" + brew bundle + ;; +esac + # OSX Defaults case "$(uname -s)" in Darwin) diff --git a/dot_scripts/upgrade.sh b/dot_scripts/upgrade.sh index 34490dc..d8d38c0 100755 --- a/dot_scripts/upgrade.sh +++ b/dot_scripts/upgrade.sh @@ -2,9 +2,16 @@ export SDKMAN_DIR="$HOME/.sdkman" [[ -s "$SDKMAN_DIR/bin/sdkman-init.sh" ]] && source "$SDKMAN_DIR/bin/sdkman-init.sh" sdk selfupdate -brew update -#brew upgrade -brew outdated | xargs brew upgrade + +# Upgrading HomeBrew stuff +case "$(uname -s)" in + Darwin) + echo "(Mac OS X) Homebrew upgrading stuff" + brew update + #brew upgrade + brew outdated | xargs brew upgrade + ;; +esac bundle update --all #gem update --system @@ -15,5 +22,5 @@ sudo pip3 install --upgrade pip 2>/dev/null pip list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U pip freeze > ~/requirements.txt # Update VIM plugins installed via Vundle https://github.com/VundleVim/Vundle.vim -vim +PluginUpdate +qall +vim +PluginUpdate +qall > /dev/null rustup-update