mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 16:53:00 +00:00
feat(bootstrap): Bootstrap script for GNU/Linux without admin
This commit is contained in:
parent
cb81dc8d53
commit
8aa9daf582
12 changed files with 340 additions and 80 deletions
28
bootstrap/linux/symlinks.bash
Normal file
28
bootstrap/linux/symlinks.bash
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
set -e # Exit immediately if a command exits with a non-zero status
|
||||
|
||||
declare -A linkDots
|
||||
|
||||
|
||||
source "$DOTFILES/bootstrap/components/symlinks.sh"
|
||||
|
||||
echo "[INFO] DOTFILES = $DOTFILES"
|
||||
|
||||
echo "[ACTION] Press any key to proceed"
|
||||
read -n 1
|
||||
|
||||
echo "[INFO] Setting up symbolic links"
|
||||
|
||||
for src in "${!linkDots[@]}"; do
|
||||
dest="${linkDots[$src]}"
|
||||
echo "Linking $src to $dest"
|
||||
if [ -d "$src" ]; then
|
||||
test -d "$dest" && mv "$dest" "$dest.bak"
|
||||
ln -sf "$src" "$dest"
|
||||
elif [ -f "$src" ]; then
|
||||
dest_parent=$(dirname "$dest")
|
||||
test -d "$dest_parent" || mkdir -p "$dest_parent"
|
||||
ln -sf "$src" "$dest"
|
||||
else
|
||||
echo "[ERROR] $src does not exist"
|
||||
fi
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue