Repository navigation
Expand file tree
/
Copy pathbootstrap.sh
More file actions
executable file
·52 lines (43 loc) · 1.56 KB
/
Copy pathbootstrap.sh
File metadata and controls
executable file
·52 lines (43 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env bash
#
# dotfiles - bootstrap.sh
# Copyright © 2025 Space Code. All rights reserved.
#
# This script synchronizes the dotfiles from the repository to the user's
# home directory. It uses rsync to copy configuration files and then
# sources the .bash_profile to apply changes.
#
# Navigate to the directory where the script is located
cd "$(dirname "${BASH_SOURCE[0]}")" || exit
# Pull the latest changes from the main branch
git pull origin main
# Function to update the home directory with the dotfiles
update() {
mkdir -p ~/.lldb
rsync -avh --no-perms ./.lldbinit ~
# rsync parameters:
# -a: archive mode (preserves permissions, symlinks, etc.)
# -v: verbose output
# -h: human-readable numbers
# --no-perms: do not preserve permissions (useful for cross-OS sync)
# --exclude: skip files that should not be in the home directory
rsync -avh --no-perms \
--exclude=".DS_Store" \
--exclude="__pycache__/" \
--exclude="*.pyc" \
./lldb ~/.lldb/
echo "✅ LLDB scripts updated successfully in ~/.lldb/"
}
# Check if the --force or -f flag is provided to skip the confirmation prompt
if [[ "$1" == "--force" || "$1" == "-f" ]]; then
update
else
# Ask the user for confirmation before overwriting files in the home directory
read -rp "This may overwrite existing files in your home directory. Are you sure? (y/n) " response
echo
if [[ "$response" =~ ^[Yy]$ ]]; then
update
fi
fi
# Clean up the update function from the shell environment
unset -f update