Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# ~/.bashrc

# Source global bash settings
if [ -f ~/dotfiles/bash_aliases ]; then
source ~/dotfiles/bash_aliases
fi

# Load common aliases
if [ -f ~/dotfiles/aliases ]; then
source ~/dotfiles/aliases
fi
73 changes: 73 additions & 0 deletions makesymlinks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,78 @@ dir=~/dotfiles # dotfiles directory
olddir=~/dotfiles_old # old dotfiles backup directory
files=("bash_aliases" "vimrc" "vim" "tmux.conf" "gitignore_global" "inputrc" "zsh_aliases" "pdbrc" "pdbrc.py") # list of files/folders to symlink in homedir

# Add shell specific rc file
case "$(detect_shell)" in
zsh)
files+=("zshrc")
;;
*)
files+=("bashrc")
;;
esac

detect_shell() {
basename "$SHELL"
}

detect_os() {
local os="$(uname)"
case "$os" in
Darwin)
echo "macos"
;;
Linux)
if [ -f /etc/os-release ]; then
. /etc/os-release
case "$ID" in
ubuntu)
echo "ubuntu"
;;
rhel|centos)
echo "redhat"
;;
*)
echo "linux"
;;
esac
else
echo "linux"
fi
;;
*)
echo "unknown"
;;
esac
}

os_specific_setup() {
local os_name
os_name=$(detect_os)
case "$os_name" in
macos)
echo "macOS detected"
if command -v brew >/dev/null 2>&1; then
xargs brew install < "$dir/brew_requirements.txt"
fi
;;
ubuntu)
echo "Ubuntu detected"
if command -v apt-get >/dev/null 2>&1; then
sudo apt-get update
fi
;;
redhat)
echo "RedHat detected"
if command -v yum >/dev/null 2>&1; then
sudo yum update -y
fi
;;
*)
echo "OS $os_name not specifically handled"
;;
esac
}

create_backup() {
# Create dotfiles_old in homedir
echo -n "Creating $olddir for backup of any existing dotfiles in ~ ..."
Expand Down Expand Up @@ -98,6 +170,7 @@ main() {
cd ~ || exit
setup_new_files
setup_git
os_specific_setup
}


Expand Down
11 changes: 11 additions & 0 deletions zshrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# ~/.zshrc

# Source custom zsh settings
if [ -f ~/dotfiles/zsh_aliases ]; then
source ~/dotfiles/zsh_aliases
fi

# Load common aliases
if [ -f ~/dotfiles/aliases ]; then
source ~/dotfiles/aliases
fi