diff --git a/config/local-templates/profile.local b/config/local-templates/profile.local index f2c4e2e..69990c0 100644 --- a/config/local-templates/profile.local +++ b/config/local-templates/profile.local @@ -1,3 +1,4 @@ POWERLINE_ROOT=/usr/share/powerline NO_NEOFETCH=0 NO_GIT_CHECK=1 +NO_ZSH_COWSAY=1 diff --git a/config/profile b/config/profile index a4cb3e4..361ecae 100644 --- a/config/profile +++ b/config/profile @@ -1,5 +1,3 @@ -source "$HOME/.zsh_functions" - # Override in .profile.local for custom repo DOTFILES_LOCAL_REPOSITORY="https://gitbox.branderson.io/branderson/dotfiles-local" @@ -41,6 +39,8 @@ if [ -f "$HOME/.dotfiles-dir" ]; then source "$HOME/.dotfiles-dir" fi +source "$HOME/.bash_functions" + # Set up brew if on macOS if [[ $OSTYPE == 'darwin'* ]]; then if [ -f /opt/homebrew/bin/brew ]; then @@ -84,7 +84,7 @@ export PATH="$PYENV_ROOT/bin:$PATH" ## Find existing keys, supporting one layer of folder organization public_keys=($(find "$HOME/.ssh/" -maxdepth 2 -name "*.pub")) if [ ${#public_keys[@]} -gt 0 ]; then - for public_key in ${public_keys[@]}; do + for public_key in "${public_keys[@]}"; do if [[ $(uname -s) == Linux* ]]; then # Add SSH keys only if not already present ssh-add -l | grep -q `ssh-keygen -lf "$public_key" | awk '{print $2}'` || ssh-add -k diff --git a/dotfiles-local.sh b/dotfiles-local.sh index 5cc721c..6facb39 100755 --- a/dotfiles-local.sh +++ b/dotfiles-local.sh @@ -1,5 +1,12 @@ #!/bin/bash +# Source .profile.local in case it's been recently updated with repo +source "$HOME/.profile" +if [ -f "$HOME/.profile.local" ]; then + source "$HOME/.profile.local" +fi +source "$DOTFILES_DIR/functions.sh" + # Check if running interactively if [ -t 0 ]; then # Interactive session @@ -39,8 +46,6 @@ configs=" i3/config.local " -source "$DOTFILES_DIR/functions.sh" - # Clone dotfiles_local if not present if [ ! -d "$locals_dir" ]; then echo "Cloning local dotfiles repository: $DOTFILES_LOCAL_REPOSITORY to $locals_dir" @@ -176,6 +181,8 @@ while IFS= read -r config || [[ -n $config ]]; do fi mv "$HOME/.$config" "$config_dir/$config" fi + elif [ -f "$locals_dir/config/$config" ]; then + echo "No local dotfile in ~/.$config but present in dotfiles-local. Symlinking" fi if [[ $skip == 0 ]] && [[ -f "$locals_dir/config/$config" ]]; then ln -s "$locals_dir/config/$config" "$HOME/.$config" @@ -209,6 +216,8 @@ while IFS= read -r config || [[ -n $config ]]; do fi mv "$HOME/.config/$config" "$config_dir/$config" fi + elif [ -f "$locals_dir/config/$config" ]; then + echo "No local dotfile in ~/.config/$config but present in dotfiles-local. Symlinking" fi if [[ $skip == 0 ]] && [[ -f "$locals_dir/config/$config" ]]; then ln -s "$locals_dir/config/$config" "$HOME/.config/$config" @@ -223,6 +232,7 @@ done < <(printf '%s' "$configs") if [[ `git status --porcelain` ]]; then # Changes found # sync dotfiles to git + echo "" if [ "$interactive" == 0 ]; then echo "Syncing local dotfiles to git branch. [$branch_name]" else diff --git a/install.sh b/install.sh index 5552746..367ef51 100755 --- a/install.sh +++ b/install.sh @@ -195,7 +195,7 @@ function link_dotfiles { for file in $home_files; do if [[ -f $file || -d $file ]]; then # Don't skip if not interactive as initial files often exist that should be replaced - if [[ (-f ~/.$file || -d ~/.$file) && "$interactive" -eq 1 ]]; then + if [[ (-L "~/.$file" || -f ~/.$file || -d ~/.$file) && "$interactive" -eq 1 ]]; then echo "Skipping: $file because ~/.$file already exists" else echo "Linking: $file ($config_dir/$file -> ~/.$file)" @@ -206,7 +206,7 @@ function link_dotfiles { for file in $configs; do if [[ -f $file || -d $file ]]; then # TODO: Check if file is a symlink and only skip if it is, otherwise rename and replace - if [[ -f ~/.config/$file || -d ~/.config/$file ]]; then + if [[ -L ~/.config/$file || -f ~/.config/$file || -d ~/.config/$file ]]; then echo "Skipping: $file because ~/.config/$file already exists" else echo "Linking: $file ($config_dir/$file -> ~/.config/$file)" @@ -216,7 +216,7 @@ function link_dotfiles { done for file in $local_home_templates; do if [[ -f ./local-templates/$file || -d ./local-templates/$file ]]; then - if [[ -f ~/.$file || -d ~/.$file ]]; then + if [[ -L "~/.$file" || -f ~/.$file || -d ~/.$file ]]; then echo "Skipping: $file because ~/.$file already exists" else echo "Copying: $file ($config_dir/local-templates/$file -> ~/.$file)" @@ -236,7 +236,7 @@ function link_dotfiles { done for file in $systemd_services; do if [[ -f systemd/user/$file || -d systemd/user/$file ]]; then - if [[ -f ~/.config/systemd/user/$file || -d ~/.config/systemd/user/$file ]]; then + if [[ -L "~/.config/systemd/user/$file" || -f ~/.config/systemd/user/$file || -d ~/.config/systemd/user/$file ]]; then echo "Skipping: $file because ~/.config/systemd/user/$file already exists" else echo "Linking: $file ($config_dir/systemd/user/$file -> ~/.config/systemd/user/$file)"