| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- #!/bin/bash
- # Quick Script to setup terminal environment
- host=$(hostname)
- hostname="${host^^}"
- repo_directory="/home/control/qconfig_$hostname"
- # Set Permissions
- chmod 660 ./*
- chmod 660 "$HOME/.bashrc"
- chmod 770 "$HOME/dots"
- function add_string_to_file() {
- # Checks if a string is in a file
- # adds it if it isn't in that file
- local file="$1"
- local string="$2"
- if ! grep -q "$string" "$file"; then
- echo "$string" >> "$file"
- fi
- }
- # Bashrc
- add_string_to_file "$HOME/.bashrc" "# Setup Aliases"
- add_string_to_file "$HOME/.bashrc" "source $HOME/dots/default_aliases"
- add_string_to_file "$HOME/.bashrc" "source $HOME/dots/seafly-prompt"
- add_string_to_file "$HOME/.bashrc" "# Scripts"
- add_string_to_file "$HOME/.bashrc" "bash $HOME/dots/life.sh 1993-07-21 control"
- # NVIM
- mkdir -p "$HOME/.config/nvim/"
- cp "./nvim" "$HOME/.config/nvim/init.vim"
- # TMUX
- cp "./tmux.conf" "$HOME/.tmux.conf"
- # PATH VARS
- if [ -f "$HOME/.dots/user_paths" ]; then
- chmod 660 "$HOME/.dots/user_paths"
- add_string_to_file "$HOME/.bashrc" "# PATH FILE"
- add_string_to_file "$HOME/.bashrc" "source $HOME/.dots/user_paths"
- fi
- if [ -f "$HOME/.dots/user_aliases" ]; then
- chmod 660 "$HOME/.dots/user_aliases"
- add_string_to_file "$HOME/.bashrc" "# USER ALIASES"
- add_string_to_file "$HOME/.bashrc" "source $HOME/.dots/user_aliases"
- fi
- if [ -f "$repo_directory/user_paths" ]; then
- chmod 660 "$repo_directory/user_paths"
- add_string_to_file "$HOME/.bashrc" "# PATH FILE"
- add_string_to_file "$HOME/.bashrc" "source $repo_directory/user_paths"
- fi
- if [ -f "$repo_directory/user_aliases" ]; then
- chmod 660 "$repo_directory/user_aliases"
- add_string_to_file "$HOME/.bashrc" "# USER ALIASES"
- add_string_to_file "$HOME/.bashrc" "source $repo_directory/user_aliases"
- fi
- # Source
- source "$HOME/.bashrc"
|