fix: improve dotpull alias and enhance stow installation script with better error handling
This commit is contained in:
@@ -7,7 +7,7 @@ alias h='history'
|
|||||||
alias grep='grep --color=auto'
|
alias grep='grep --color=auto'
|
||||||
alias d='docker'
|
alias d='docker'
|
||||||
alias dc='docker compose'
|
alias dc='docker compose'
|
||||||
alias dotpull='echo "🔄 Updating dotfiles..." && git -C ~/.dotfiles pull && echo "🔗 Re-stowing dotfiles..." && (cd ~ && stow -R .dotfiles) && echo "✅ Done."'
|
alias dotpull='echo "🔄 Updating dotfiles..." && git -C ~/.dotfiles pull && echo "🔗 Re-stowing dotfiles..." && cd ~ && (stow --adopt .dotfiles 2>/dev/null || stow -R .dotfiles) && echo "✅ Done."'
|
||||||
|
|
||||||
alias reloadbash='source ~/.bashrc && echo "Bash config reloaded."'
|
alias reloadbash='source ~/.bashrc && echo "Bash config reloaded."'
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ fi
|
|||||||
# Change to parent directory of dotfiles for stow to work correctly
|
# Change to parent directory of dotfiles for stow to work correctly
|
||||||
cd "$HOME"
|
cd "$HOME"
|
||||||
|
|
||||||
# Backup existing files that would conflict with stow
|
# Backup existing files that would conflict with stow (excluding SSH config - it's machine-specific)
|
||||||
for file in .bashrc .bash_aliases .inputrc .gitconfig; do
|
for file in .bashrc .bash_aliases .inputrc .gitconfig; do
|
||||||
if [ -f "$HOME/$file" ] && [ ! -L "$HOME/$file" ]; then
|
if [ -f "$HOME/$file" ] && [ ! -L "$HOME/$file" ]; then
|
||||||
echo "⚠️ Backing up existing file: $HOME/$file -> $HOME/${file}.bak"
|
echo "⚠️ Backing up existing file: $HOME/$file -> $HOME/${file}.bak"
|
||||||
@@ -33,9 +33,12 @@ for file in .bashrc .bash_aliases .inputrc .gitconfig; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Use stow to create symlinks
|
# Use stow to create symlinks with --adopt to handle existing symlinks gracefully
|
||||||
echo "🔗 Using Stow to symlink dotfiles..."
|
echo "🔗 Using Stow to symlink dotfiles..."
|
||||||
stow -d "$HOME" -t "$HOME" .dotfiles
|
if ! stow --adopt .dotfiles 2>/dev/null; then
|
||||||
|
echo "🔄 Adopting failed, trying regular stow..."
|
||||||
|
stow .dotfiles
|
||||||
|
fi
|
||||||
|
|
||||||
# Optionally source the new bashrc
|
# Optionally source the new bashrc
|
||||||
if [[ $- == *i* ]]; then
|
if [[ $- == *i* ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user