feat: Improve bootstrap

This commit is contained in:
Xavier Logerais 2022-05-21 02:30:05 +02:00
parent b75c801a47
commit d8a7adcdbb
8 changed files with 153 additions and 76 deletions

View File

@ -1,3 +1,7 @@
# config-bootstrap # config-bootstrap
Just a script to easily setup my shell environment on new devices. Just a script to easily setup my shell environment on new devices.
```
git clone https://github.com/xlogerais/config-bootstrap.git ~/.bootstrap && cd ~/.bootstrap && bash bootstrap.bash
```

18
anyenv.bash Normal file
View File

@ -0,0 +1,18 @@
# # Anyenv
#
# git clone https://github.com/anyenv/anyenv.git ~/.anyenv
# export PATH="$HOME/.anyenv/bin:$PATH"
# yes | anyenv install --init
#
# eval "$(anyenv init -)"
# git clone https://github.com/znz/anyenv-update.git $(anyenv root)/plugins/anyenv-update
# git clone https://github.com/znz/anyenv-git.git $(anyenv root)/plugins/anyenv-git
#
# # sudo apt install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev
# yes | anyenv install pyenv
# eval "$(anyenv init -)"
# git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv
#
# # sudo apt install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm5 libgdbm-dev
# yes | anyenv install rbenv
# eval "$(anyenv init -)"

View File

@ -1,76 +0,0 @@
#!/bin/bash
sudo apt update
sudo apt upgrade -y
sudo apt install -y coreutils grep less tar tree
sudo apt install -y man manpages-fr manpages-fr-extra
sudo apt install -y bash zsh fish
sudo apt install -y screen tmux
sudo apt install -y openssh mosh
sudo apt install -y vim git tig
sudo apt install -y wget curl lftp fping mtr socat
sudo apt install -y jq
# DIRS
mkdir ~/.bin
mkdir -p ~/.local/share/fonts
# Configuration GIT
git config --global user.name "Xavier Logerais"
git config --global user.email "xavier@logerais.com"
# Configuration BASH
git clone --recursive https://github.com/xlogerais/config-bash.git ~/.bash
bash ~/.bash/create-links.bash
# Configuration VIM
git clone --recursive https://github.com/xlogerais/config-vim.git ~/.vim
bash ~/.vim/create-links.bash
git clone https://github.com/vim-airline/vim-airline ~/.vim/bundle/vim-airline
git clone https://github.com/vim-airline/vim-airline-themes ~/.vim/bundle/vim-airline-themes
#git clone https://github.com/itchyny/lightline.vim ~/.vim/bundle/lightline
# Configuration SCREEN
git clone --recursive https://github.com/xlogerais/config-screen.git ~/.screen
bash ~/.screen/create-links.bash
# Configuration TMUX
git clone --recursive https://github.com/xlogerais/config-tmux.git ~/.tmux
bash ~/.tmux/create-links.bash
# FONTS
#TODO# Download some fonts from Nerdfonts
fc-cache --force --verbose ~/.local/share/fonts
# Powerline-go
curl -sL https://api.github.com/repos/justjanne/powerline-go/releases/latest | jq -r '.assets[].browser_download_url | match(".*linux.*") | .string' | wget -i - -O ~/.bin/powerline-go && chmod +x ~/.bin/powerline-go
# Mcfly
#TODO# Add instructions to install mcfly
# Anyenv
git clone https://github.com/anyenv/anyenv.git ~/.anyenv
export PATH="$HOME/.anyenv/bin:$PATH"
yes | anyenv install --init
eval "$(anyenv init -)"
git clone https://github.com/znz/anyenv-update.git $(anyenv root)/plugins/anyenv-update
git clone https://github.com/znz/anyenv-git.git $(anyenv root)/plugins/anyenv-git
# sudo apt install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev
yes | anyenv install pyenv
eval "$(anyenv init -)"
git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv
# sudo apt install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm5 libgdbm-dev
yes | anyenv install rbenv
eval "$(anyenv init -)"

6
bootstrap.bash Normal file
View File

@ -0,0 +1,6 @@
#!/bin/bash
bash system-ubuntu.bash
bash tools.bash
bash fonts.bash
bash config.bash

46
config.bash Normal file
View File

@ -0,0 +1,46 @@
#!/bin/bash
# Configuration GIT
git config --global user.name "Xavier Logerais"
git config --global user.email "xavier@logerais.com"
# Configuration BASH
if [[ ! -d ~/.bash ]]
then
git clone --recursive https://github.com/xlogerais/config-bash.git ~/.bash
bash ~/.bash/create-links.bash
fi
# Configuration VIM
if [[ ! -d ~/.vim ]]
then
git clone --recursive https://github.com/xlogerais/config-vim.git ~/.vim
bash ~/.vim/create-links.bash
fi
# Configuration NVIM
if [[ ! -d ~/.config/nvim ]]
then
git clone https://github.com/AstroNvim/AstroNvim ~/.config/nvim
nvim +PackerSync
fi
# Configuration SCREEN
if [[ ! -d ~/.screen ]]
then
git clone --recursive https://github.com/xlogerais/config-screen.git ~/.screen
bash ~/.screen/create-links.bash
fi
# Configuration TMUX
if [[ ! -d ~/.tmux ]]
then
git clone --recursive https://github.com/xlogerais/config-tmux.git ~/.tmux
bash ~/.tmux/create-links.bash
fi

21
fonts.bash Normal file
View File

@ -0,0 +1,21 @@
# FONTS
fontdir="$HOME/.local/share/fonts"
declare -a fonts
fonts+=("Inconsolata")
fonts+=("Ubuntu")
fonts+=("Hack")
fonts+=("DejaVuSansMono")
# Create font dir
test -d "${fontdir}" || mkdir -p "${fontdir}"
# Download fonts
for font in "${fonts[@]}"
do
wget -q -O /tmp/${font}.zip "https://github.com/ryanoasis/nerd-fonts/releases/latest/download/${font}.zip" && cd ${fontdir} && unzip -u /tmp/${font}.zip && rm /tmp/${font}.zip
done
# Refresh cache
fc-cache --force --verbose ${fontdir}

15
system-ubuntu.bash Normal file
View File

@ -0,0 +1,15 @@
#!/bin/bash
if ( grep -q Ubuntu <(lsb_release -i) )
then
sudo apt update
sudo apt upgrade -y
sudo apt install -y coreutils grep less tar tree
sudo apt install -y man manpages-fr manpages-fr-extra
sudo apt install -y bash zsh fish
sudo apt install -y screen tmux
sudo apt install -y openssh mosh
sudo apt install -y vim git #tig
sudo apt install -y wget curl lftp fping mtr socat
fi

43
tools.bash Normal file
View File

@ -0,0 +1,43 @@
#!/bin/bash
# Install asdf
test -d $HOME/.asdf || git clone https://github.com/asdf-vm/asdf.git $HOME/.asdf
source $HOME/.asdf/asdf.sh
source $HOME/.asdf/completions/asdf.bash
# Install plugins and tools
declare -a tools
tools+=(shellcheck)
tools+=(direnv)
tools+=(lazygit)
tools+=(jq yq)
tools+=(kubectl helm k9s)
tools+=(vault)
tools+=(terraform terragrunt)
for tool in "${tools[@]}"
do
echo
echo "-- Installing ${tool}"
asdf plugin add ${tool}
asdf install ${tool} latest
asdf global ${tool} latest
done
# Powerline-go
echo
echo "-- Installing powerline-go"
asdf plugin add justjanne-powerline-go git@plmlab.math.cnrs.fr:plmteam/common/asdf/justjanne/asdf-justjanne-powerline-go.git
asdf install justjanne-powerline-go latest
asdf global justjanne-powerline-go latest
# Mcfly
echo
echo "-- Installing mcfly"
asdf plugin add mcfly https://github.com/barolab/asdf-mcfly.git
asdf install mcfly latest
asdf global mcfly latest