refactor config

This commit is contained in:
Alexander Navarro 2023-02-13 01:53:52 -03:00
commit 4f0e213f4a
155 changed files with 13983 additions and 0 deletions

23
config/create-links Executable file
View file

@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
[[ ! -e "$HOME/.config" ]] && mkdir -p "$HOME/.config/"
echo "Creating symlinks..."
for var in $SCRIPT_DIR/*; do
pkg=$(basename "$var")
# if exist and is not a symlink
if [[ -e "$HOME/.config/$pkg" && ! -h "$HOME/.config/$pkg" ]]; then
echo "Config for $pkg exist, creating backup ${pkg}.old"
mv "$HOME/.config/$pkg" "$HOME/.config/${pkg}.old"
elif [[ -e "$HOME/.config/$pkg" && -h "$HOME/.config/$pkg" ]]; then
unlink "$HOME/.config/$pkg"
fi
ln -sf "$var" "$HOME/.config/"
done