Skip to content

Commit

Permalink
Add functionality to remove existing default configs
Browse files Browse the repository at this point in the history
  • Loading branch information
flokoe committed Jan 17, 2024
1 parent 268e4b2 commit 9f5edb9
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,36 @@ sudo apt-get install -y git curl stow vim fish neovim kitty
# Install starship
curl -sS https://starship.rs/install.sh | sh -s -- --yes

# Enable dotfiles
stow fish starship
# Enable dotfiles for the following packages
PACKAGES=(fish starship)

# Remove existing default configs so stow does not fail
for p in "${PACKAGES[@]}"; do
# Get list of all files within packages
files="$(find "$p" -mindepth 1)"

# Remove leading package name from all files
files="${files//${p}\//}"

# Replace dot- syntax with actual dot in file path
files="${files//dot-/.}"

for f in $files; do
# Construct full file path
f="${HOME}/${f}"

if [[ $f == *"$p"* ]]; then
# Remove existing config
echo "Remove the following path: ${f}"
rm -rf "$f"

break
fi
done
done

# Link dotfiles aka install packages via stow
stow "${PACKAGES[@]}"

# Install fisher plugin manager
fish -c "curl -sL https://git.io/fisher | source && fisher update"
Expand Down

0 comments on commit 9f5edb9

Please sign in to comment.