diff --git a/install.sh b/install.sh index c8fd447..d6ca3e8 100755 --- a/install.sh +++ b/install.sh @@ -1,7 +1,8 @@ #!/bin/bash packages="sshpass tmux python3-pip cargo vim-nox build-essential python3-dev \ - zathura zathura-pdf-poppler" + gcc-9 g++-9 python2 python2-dev guestfish libncurses-dev" + pip="awscli cmake" read -p "Are you sure? (Y/N) " @@ -18,110 +19,147 @@ mkdir -p ~/.config release=$(lsb_release -d | grep -i ubuntu > /dev/null && echo ubuntu || echo unknown) echo "Release is $release" -if [[ "$release" == "ubuntu" ]] -then - echo "Installing packages ..." - sudo apt install -y $packages -fi - -if [[ -f /usr/bin/pip3 ]] -then - echo "Pip 3 detected, installing packages ..." - pip install --user -U $pip -fi - -if [[ -f ~/.dotfiles/inputrc ]] -then - echo "Installing inputrc ..." - rm -rf ~/.inputrc - ln -sf ~/.dotfiles/inputrc ~/.inputrc -fi - -if [[ -f ~/.dotfiles/bash/bashrc ]] -then - echo "Dotfiles bashrc found, linking it ..." - rm -rf ~/.bashrc - ln -sf ~/.dotfiles/bash/bashrc ~/.bashrc -fi - -if [[ -f ~/.dotfiles/tmux/tmux.conf ]] -then - echo "Dotfiles tmux.conf found, linking it ..." - rm -rf ~/.tmux.conf - ln -sf ~/.dotfiles/tmux/tmux.conf ~/.tmux.conf - rm -rf ~/.tmux - ln -sf ~/.dotfiles/tmux ~/.tmux -fi - -# I hate this but no other option worked ... -if [[ ! -f /usr/local/bin/starship ]] -then - echo "Installing starship ..." - curl -sS https://starship.rs/install.sh | sh -fi - -if [[ -f ~/.dotfiles/starship/starship.toml ]] -then - echo "Installing starship configuration ..." - rm -rf ~/.config/starship.toml - ln -sf ~/.dotfiles/starship/starship.toml ~/.config/starship.toml -fi - -if [[ -f ~/.dotfiles/git/gitconfig ]] -then - echo "Installing git configuration ..." - rm -rf ~/.gitconfig - ln -sf ~/.dotfiles/git/gitconfig ~/.gitconfig -fi - -if [[ -d ~/.dotfiles/ssh ]] -then - echo "Installing ssh configuration ..." - rm -rf ~/.ssh - ln -sf ~/.dotfiles/ssh ~/.ssh -fi - -if [[ -d ~/.dotfiles/vim ]] -then - echo "Installing vim configuration ..." - rm -rf ~/.vimrc - mkdir -p ~/.vim/bundle - mkdir -p ~/.vimundo - if [[ ! -d ~/.vim/bundle/Vundle.vim ]] +install_packages() { + if [[ "$release" == "ubuntu" ]] then - git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim + echo "Installing packages ..." + sudo apt install -y $packages + echo "Updating alternatives ..." + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9 + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 9 fi - ln -sf ~/.dotfiles/vim/vimrc ~/.vimrc - echo "Installing vim plugins ..." - vim +'PlugInstall --sync' +qa +} + +install_pip() { + if [[ -f /usr/bin/pip3 ]] + then + echo "Pip 3 detected, installing packages ..." + pip install --user -U $pip + fi + + if [[ -f ~/.dotfiles/inputrc ]] + then + echo "Installing inputrc ..." + rm -rf ~/.inputrc + ln -sf ~/.dotfiles/inputrc ~/.inputrc + fi + + if [[ -f ~/.dotfiles/bash/bashrc ]] + then + echo "Dotfiles bashrc found, linking it ..." + rm -rf ~/.bashrc + ln -sf ~/.dotfiles/bash/bashrc ~/.bashrc + fi + + if [[ -f ~/.dotfiles/tmux/tmux.conf ]] + then + echo "Dotfiles tmux.conf found, linking it ..." + rm -rf ~/.tmux.conf + ln -sf ~/.dotfiles/tmux/tmux.conf ~/.tmux.conf + rm -rf ~/.tmux + ln -sf ~/.dotfiles/tmux ~/.tmux + fi +} + +install_starship() { + # I hate this but no other option worked ... + if [[ ! -f /usr/local/bin/starship ]] + then + echo "Installing starship ..." + curl -sS https://starship.rs/install.sh | sh + fi +} + +setup_starship() { + if [[ -f ~/.dotfiles/starship/starship.toml ]] + then + echo "Installing starship configuration ..." + rm -rf ~/.config/starship.toml + ln -sf ~/.dotfiles/starship/starship.toml ~/.config/starship.toml + fi +} + +setup_git() { + if [[ -f ~/.dotfiles/git/gitconfig ]] + then + echo "Installing git configuration ..." + rm -rf ~/.gitconfig + ln -sf ~/.dotfiles/git/gitconfig ~/.gitconfig + fi +} + +setup_ssh() { + if [[ -d ~/.dotfiles/ssh ]] + then + echo "Installing ssh configuration ..." + rm -rf ~/.ssh + ln -sf ~/.dotfiles/ssh ~/.ssh + fi +} + +setup_vim() { + if [[ -d ~/.dotfiles/vim ]] + then + echo "Installing vim configuration ..." + rm -rf ~/.vimrc + mkdir -p ~/.vim/bundle + mkdir -p ~/.vimundo + if [[ ! -d ~/.vim/bundle/Vundle.vim ]] + then + git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim + fi + ln -sf ~/.dotfiles/vim/vimrc ~/.vimrc + echo "Installing vim plugins ..." + vim +'PlugInstall --sync' +qa + fi +} + +install_ycm() { + if [[ -d ~/.vim/bundle/YouCompleteMe ]] + then + echo "Installing ycm dependencies" + python3 ~/.vim/bundle/YouCompleteMe/install.py + fi +} + +install_projects() { + if [[ -d ~/.dotfiles/projects ]] + then + for f in ~/.dotfiles/projects/* + do + if [[ -f $f/basegit ]] + then + basegit=$(<$f/basegit) + echo "Base git $basegit sourced ..." + fi + if [[ -f $f/projects ]] + then + while read -r project + do + dir=$(basename $f) + mkdir -p ~/dev/${dir} + echo "Cloning ${basegit}${project} in ~/dev/${dir}/${project}" + git clone ${basegit}${project} ~/dev/${dir}/${project} + done < $f/projects + fi + done + fi +} + +if [[ $1 != "" ]] +then + $1 +else + install_packages + install_pip + install_starship + setup_starship + setup_ssh + setup_git + setup_vim + install_ycm + install_projects fi -if [[ -d ~/.vim/bundle/YouCompleteMe ]] -then - echo "Installing ycm dependencies" - python3 ~/.vim/bundle/YouCompleteMe/install.py -fi - -if [[ -d ~/.dotfiles/projects ]] -then - for f in ~/.dotfiles/projects/* - do - if [[ -f $f/basegit ]] - then - basegit=$(<$f/basegit) - echo "Base git $basegit sourced ..." - fi - if [[ -f $f/projects ]] - then - while read -r project - do - dir=$(basename $f) - mkdir -p ~/dev/${dir} - echo "Cloning ${basegit}${project} in ~/dev/${dir}/${project}" - git clone ${basegit}${project} ~/dev/${dir}/${project} - done < $f/projects - fi - done -fi . ~/.bashrc diff --git a/projects/enoclink/basegit b/projects/enoclink/basegit new file mode 100644 index 0000000..34bd497 --- /dev/null +++ b/projects/enoclink/basegit @@ -0,0 +1 @@ +https://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@github.com/enoc-link/ diff --git a/projects/enoclink/projects b/projects/enoclink/projects new file mode 100644 index 0000000..fe99128 --- /dev/null +++ b/projects/enoclink/projects @@ -0,0 +1,36 @@ +akstest +app +argocd +obdapp +cell-locator +cvs +dnscontrol +healthdata +healthstatus +infrastructure +livecontrol +logforwarder +logs +loki +modemcontrol +mqtt +mqtt-exporter +odoo +opkg-repository +osconfigurator +print +prometheus +queuecontrol +queuecontrol_test +registergateway +releasecontrol +rfidgateway +titr +truck-hub +truckhubapi +truckhubinit +truckhubupdate +truckos +usercontrol +vpn-dns +wificontrol diff --git a/vim/vimrc b/vim/vimrc index 8b00d6e..b6fa229 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -53,12 +53,12 @@ let g:SimpylFold_docstring_preview=1 " PEP8 indentation au BufNewFile,BufRead *.py - \ set tabstop=4 - \ set softtabstop=4 - \ set shiftwidth=4 - \ set textwidth=79 - \ set expandtab - \ set autoindent + \ set tabstop=4 | + \ set softtabstop=4 | + \ set shiftwidth=4 | + \ set textwidth=79 | + \ set expandtab | + \ set autoindent | \ set fileformat=unix " Delete trailing whitespaces on save