PageRenderTime 63ms CodeModel.GetById 27ms RepoModel.GetById 1ms app.codeStats 0ms

/nim_docker.sh

https://github.com/nim65s/scripts
Shell | 73 lines | 60 code | 9 blank | 4 comment | 18 complexity | 2284192dd3d3e2310f3f7dafd33d2303 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. #!/bin/bash
  2. # vim: tw=0
  3. # curl https://raw.githubusercontent.com/nim65s/scripts/master/nim_docker.sh | bash && fish
  4. # NB: vipe is in moreutils
  5. set -ex
  6. FD_VERSION=8.2.1
  7. RG_VERSION=12.1.1
  8. BAT_VERSION=0.18.1
  9. DELTA_VERSION=0.7.1
  10. FISH_VERSION=3.3.1
  11. if [[ $(id -u) == 0 ]]
  12. then
  13. SUDO=''
  14. else
  15. SUDO=sudo
  16. fi
  17. [[ -f /etc/alpine-release ]] && $SUDO apk add vim htop ncdu git tig gnupg fish fd
  18. [[ -f /etc/arch-release ]] && $SUDO pacman -Syu --noconfirm vim htop ncdu git tig gnupg fish fd dfc ripgrep bat
  19. [[ -f /etc/fedora-release ]] && $SUDO dnf install -y vim htop ncdu git tig gnupg fish ripgrep
  20. [[ -f /etc/debian_version ]] && $SUDO apt update -qqy && $SUDO apt install -qqy vim htop ncdu git tig gnupg2 dfc wget libpcre2-8-0 lsb-release bc gettext-base man-db
  21. if [[ -f /etc/debian_version ]]
  22. then
  23. FD="https://github.com/sharkdp/fd/releases/download/v${FD_VERSION}/fd_${FD_VERSION}_amd64.deb"
  24. RG="https://github.com/BurntSushi/ripgrep/releases/download/${RG_VERSION}/ripgrep_${RG_VERSION}_amd64.deb"
  25. BAT="https://github.com/sharkdp/bat/releases/download/v${BAT_VERSION}/bat_${BAT_VERSION}_amd64.deb"
  26. DELTA="https://github.com/dandavison/delta/releases/download/${DELTA_VERSION}/git-delta-musl_${DELTA_VERSION}_amd64.deb"
  27. wget "$FD" "$RG" "$BAT" "$DELTA"
  28. DEBIAN_VERSION=$(lsb_release -cs)
  29. if [[ ${DEBIAN_VERSION} == buster || ${DEBIAN_VERSION} == focal ]]
  30. then
  31. $SUDO apt install -qqy fish
  32. elif [[ ${DEBIAN_VERSION} != stretch ]]
  33. then
  34. FISH="https://launchpad.net/~fish-shell/+archive/ubuntu/release-3/+files/fish_${FISH_VERSION}-1~${DEBIAN_VERSION}_amd64.deb"
  35. FISH_COMMON="https://launchpad.net/~fish-shell/+archive/ubuntu/release-3/+files/fish-common_${FISH_VERSION}-1~${DEBIAN_VERSION}_all.deb"
  36. wget "$FISH" "$FISH_COMMON"
  37. $SUDO dpkg -i ./fish*.deb
  38. fi
  39. $SUDO dpkg -i ./{fd,bat,git-delta}*.deb
  40. $SUDO dpkg-divert --add --divert /usr/share/fish/completions/rg.fish.0 --rename --package ripgrep /usr/share/fish/completions/rg.fish
  41. $SUDO dpkg -i ./ripgrep*.deb
  42. rm ./*.deb
  43. elif [[ -f /etc/fedora-release ]]
  44. then
  45. echo -e '#!/bin/sh\ncat /etc/hostname' > /usr/local/bin/hostname
  46. chmod +x /usr/local/bin/hostname
  47. fi
  48. cd
  49. git clone --depth 1 https://github.com/nim65s/dotfiles.git
  50. cd dotfiles
  51. git submodule update --init Zenburn vim-plug submodules/docker-fish-completion
  52. cd
  53. for file in .bash_profile .bash_logout .tmux.conf .nanorc .vimrc .Xdefaults .gitconfig .bashrc .hgrc .zshrc .xmonad .vim .xinitrc .compton.conf .editorconfig .ipython .imapfilter .notmuch-config .msmtprc .pypirc
  54. do
  55. [[ -L $file || -f $file ]] && rm $file
  56. ln -s "$HOME/dotfiles/$file" .
  57. done
  58. mkdir -p .config
  59. cd .config
  60. for files in awesome dfc fish pep8 ranger terminator zathura flake8 terminology fontconfig khal khard vdirsyncer todoman offlineimap mutt i3 i3status rofi dunst pylintrc
  61. do
  62. [[ -L $files ]] && rm $files
  63. ln -s "$HOME/dotfiles/.config/$files" .
  64. done