PageRenderTime 83ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/install.sh

https://github.com/nim65s/scripts
Shell | 96 lines | 74 code | 18 blank | 4 comment | 17 complexity | 563d9e81499907bdb1bef4017bd5b782 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/install.sh | bash
  4. FD_VERSION=8.2.0
  5. RG_VERSION=11.0.2
  6. FISH_VERSION=3.0.2
  7. set -e
  8. set -x
  9. cd
  10. mkdir -p .config .ssh .gnupg
  11. chmod 700 .ssh .gnupg
  12. touch .gitrepos .ssh/authorized_keys
  13. [[ -f /etc/arch-release ]] && sudo pacman -Syu --noconfirm --needed git gvim fish openssh tinc python-pip rofi pass pcsc-tools ccid libusb-compat dunst msmtp-mta shellcheck dfc ripgrep fd khal khard vdirsyncer todoman ncdu bat htop tig inetutils kitty iwd
  14. [[ -f /etc/debian_version ]] && sudo apt install -qqy gnupg2 terminator git vim tinc pcscd libpcsclite1 pcsc-tools scdaemon python3-pip msmtp-mta shellcheck dfc wget libpcre2-8-0 lsb-release bc gettext-base man-db khal khard vdirsyncer todoman tig
  15. command -v yum && sudo yum install git fish vim tinc python3-pip gcc
  16. if [[ -f /etc/debian_version ]]
  17. then
  18. if grep -q buster /etc/apt/sources.list
  19. then
  20. sudo apt install -qqy fd-find ripgrep fish
  21. else
  22. FD="https://github.com/sharkdp/fd/releases/download/v${FD_VERSION}/fd_${FD_VERSION}_amd64.deb"
  23. RG="https://github.com/BurntSushi/ripgrep/releases/download/${RG_VERSION}/ripgrep_${RG_VERSION}_amd64.deb"
  24. FISH="https://launchpad.net/~fish-shell/+archive/ubuntu/release-3/+files/fish_${FISH_VERSION}-1~$(lsb_release -cs)_amd64.deb"
  25. FISH_COMMON="https://launchpad.net/~fish-shell/+archive/ubuntu/release-3/+files/fish-common_${FISH_VERSION}-1~$(lsb_release -cs)_all.deb"
  26. wget "$FD" "$RG" "$FISH" "$FISH_COMMON"
  27. sudo dpkg -i ./*.deb
  28. fi
  29. fi
  30. if [[ -z "$SSH_CLIENT" ]]
  31. then
  32. echo enable-ssh-support > .gnupg/gpg-agent.conf
  33. echo use-agent > .gnupg/gpg.conf
  34. echo default-key 7D2ACDAF4653CF28 >> .gnupg/gpg.conf
  35. echo personal-digest-preferences SHA256 >> .gnupg/gpg.conf
  36. echo cert-digest-algo SHA256 >> .gnupg/gpg.conf
  37. echo default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed >> .gnupg/gpg.conf
  38. gpg-connect-agent reloadagent /bye
  39. # Check Key
  40. gpg2 --card-status
  41. curl $(gpg2 --card-status|grep key.asc|cut -d: -f2-) | gpg --import
  42. rm -f /tmp/secret{,.gpg}
  43. echo 'IT WORKS \o/' > /tmp/secret
  44. gpg --encrypt --trusted-key 7D2ACDAF4653CF28 -r 7D2ACDAF4653CF28 /tmp/secret
  45. gpg --decrypt /tmp/secret.gpg
  46. fi
  47. export SSH_AUTH_SOCK=$(gpgconf --list-dir | grep agent-ssh-socket | cut -d: -f2)
  48. grep -q cardno:000605255506 .ssh/authorized_keys || ssh-add -L >> .ssh/authorized_keys
  49. ssh-keyscan github.com | ssh-keygen -lf - >> .ssh/known_hosts
  50. for repo in dotfiles scripts VPNim
  51. do
  52. test -d $repo || git clone git@github.com:nim65s/$repo.git --recursive
  53. pushd $repo
  54. git pull --rebase
  55. git submodule update --recursive --remote --rebase --init
  56. git submodule foreach -q --recursive 'git checkout $(git config -f $toplevel/.gitmodules submodule.$name.branch || echo master)'
  57. grep -q $repo ~/.gitrepos || pwd >> ~/.gitrepos
  58. popd
  59. done
  60. for file in .bash_profile .bash_logout .tmux.conf .nanorc .vimpagerrc .vimrc .Xdefaults .gitconfig .bashrc .hgrc .zshrc .xmonad .vim .xinitrc .compton.conf .editorconfig .ipython .imapfilter .notmuch-config .msmtprc .pypirc .latexmk
  61. do
  62. [[ -L $file || -f $file ]] && rm $file
  63. ln -s $HOME/dotfiles/$file
  64. done
  65. cd ~/.config
  66. for files in awesome dfc fish pep8 ranger terminator zathura flake8 terminology fontconfig khal khard vdirsyncer todoman offlineimap mutt i3 i3status rofi dunst pylintrc yapf picom bat kitty
  67. do
  68. [[ -L $files ]] && rm $files
  69. ln -s $HOME/dotfiles/.config/$files
  70. done
  71. cd
  72. python3 -m pip install -U --user pip
  73. python3 -m pip install -U --user IPython pygments_zenburn flake8 isort pep8-naming youtube-dl thefuck pandocfilters wheel twine pipenv docker-compose i3ipc
  74. if which cargo > /dev/null
  75. then
  76. cargo install fd-find ripgrep git-delta watchexec-cli
  77. fi
  78. grep $USER /etc/passwd | grep -q fish || echo "chsh -s $(grep fish /etc/shells)"