installation scripts for servers.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
2.2 KiB

3 years ago
3 years ago
  1. #!/bin/sh
  2. DIR="$(realpath "$(dirname "$0")")"
  3. # script must start at home directory
  4. cd "$HOME" || exit 1;
  5. usertest() {
  6. if test "$(id -u)" -eq 0; then
  7. echo "You cannot run this script as root.";
  8. exit 1;
  9. fi
  10. if ! (getent passwd junikim 2>&1) > /dev/null; then
  11. echo "User junikim must exist.";
  12. exit 1
  13. fi
  14. }
  15. dev() {
  16. echo "Developer tools..."
  17. sudo xbps-install -Sy make python3 nodejs neovim curl
  18. }
  19. sysinfo() {
  20. echo "Dylan Araps scripts"
  21. cd "$HOME" || exit 1;
  22. mkdir -p repos
  23. git clone https://github.com/dylanaraps/pfetch "$HOME/repos/pfetch"
  24. git clone https://github.com/dylanaraps/neofetch "$HOME/repos/neofetch"
  25. git clone https://github.com/dylanaraps/fff "$HOME/repos/fff"
  26. cd "$HOME/repos/pfetch" || exit 1;
  27. sudo make install || exit 2;
  28. cd "$HOME" || exit 1;
  29. cd "$HOME/repos/neofetch" || exit 1;
  30. sudo make install || exit 2;
  31. cd "$HOME" || exit 1;
  32. cd "$HOME/repos/fff" || exit 1;
  33. sudo make install || exit 2;
  34. cd "$HOME" || exit 1;
  35. }
  36. shell() {
  37. echo "zsh installation and configuration as login shell"
  38. sudo xbps-install -Sy zsh starship
  39. chsh -s /bin/zsh
  40. }
  41. # neovim must be installed.
  42. plugins() {
  43. # install vim-plug, oh-my-zsh, and zsh-syntax-highlighting
  44. sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
  45. https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
  46. sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
  47. git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "$HOME/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting"
  48. }
  49. dotfiles() {
  50. echo "Adding vim and zsh configs"
  51. if ! test -d "$DIR/dotfiles"; then
  52. echo "$DIR/dotfiles folder not found.";
  53. exit 1;
  54. fi
  55. # add in alacritty support
  56. curl -sSL https://raw.githubusercontent.com/alacritty/alacritty/master/extra/alacritty.info | tic -x -
  57. mkdir -p "$HOME/.config/nvim"
  58. cp "$DIR/dotfiles/.zshrc" "$HOME/.zshrc"
  59. cp "$DIR/dotfiles/init.vim" "$HOME/.config/nvim/init.vim"
  60. nvim --headless +PlugInstall +qa
  61. }
  62. (usertest && dev && sysinfo && shell && plugins && dotfiles) || exit 1
  63. cat <<EOF
  64. Stuff you should do now:
  65. - run :PlugInstall
  66. - add coc extensions
  67. EOF