setup.sh 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/bash
  2. # Quick Script to setup terminal environment
  3. # Set Permissions
  4. chmod 660 ./*
  5. chmod 660 "$HOME/.bashrc"
  6. chmod 770 "$HOME/dots"
  7. function add_string_to_file() {
  8. # Checks if a string is in a file
  9. # adds it if it isn't in that file
  10. local file="$1"
  11. local string="$2"
  12. if ! grep -q "$string" "$file"; then
  13. echo "$string" >> "$file"
  14. fi
  15. }
  16. # Bashrc
  17. add_string_to_file "$HOME/.bashrc" "# Setup Aliases"
  18. add_string_to_file "$HOME/.bashrc" "source $HOME/dots/default_aliases"
  19. add_string_to_file "$HOME/.bashrc" "source $HOME/dots/seafly-prompt"
  20. add_string_to_file "$HOME/.bashrc" "# Scripts"
  21. add_string_to_file "$HOME/.bashrc" "bash $HOME/dots/life.sh 1993-07-21 control"
  22. # NVIM
  23. mkdir -p "$HOME/.config/nvim/"
  24. cp "./nvim" "$HOME/.config/nvim/init.vim"
  25. # TMUX
  26. cp "./tmux.conf" "$HOME/.tmux.conf"
  27. # PATH VARS
  28. if [ -f "$HOME/.dots/user_paths" ]; then
  29. chmod 660 "$HOME/.dots/user_paths"
  30. add_string_to_file "$HOME/.bashrc" "# PATH FILE"
  31. add_string_to_file "$HOME/.bashrc" "source $HOME/.dots/user_paths"
  32. fi
  33. if [ -f "$HOME/.dots/user_aliases" ]; then
  34. chmod 660 "$HOME/.dots/user_aliases"
  35. add_string_to_file "$HOME/.bashrc" "# USER ALIASES"
  36. add_string_to_file "$HOME/.bashrc" "source $HOME/.dots/user_aliases"
  37. fi
  38. # Source
  39. source "$HOME/.bashrc"