config/install/install-symlinks.sh

23 lines
497 B
Bash
Executable File

#!/bin/bash
echo "***** INSTALL SYMLINKS *****"
ROOTDIR=$(cd "$(dirname "$0")/.." && pwd)
# Create config directory if not present
mkdir -p "$HOME/.config"
for srcdir in $(find "$ROOTDIR/.config" -mindepth 1 -maxdepth 1 -type d); do
dstdir="$HOME/.config/$(basename $srcdir)"
# Backup configs that are not already symlinked
if [ -e "$dstdir" ] && [ ! -L "$dstdir" ]; then
mv -v "$dstdir" "$dstdir.backup"
fi
# Create symlinks, forcing updates
ln -fnsv "$srcdir" "$dstdir"
done
echo