-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap
More file actions
executable file
·44 lines (37 loc) · 1.13 KB
/
Copy pathbootstrap
File metadata and controls
executable file
·44 lines (37 loc) · 1.13 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
#!/usr/bin/env bash
#
# dotfiles - bootstrap
# Copyright © 2025 Space Code. All rights reserved.
#
# This script synchronizes the dotfiles from the repository to the user's
# home directory. It is identical to bootstrap.sh and provided as an
# alternative command name.
#
# 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() {
# Synchronize configuration files using rsync
rsync --exclude ".git/" \
--exclude ".DS_Store" \
--exclude "bootstrap.sh" \
--exclude "README.md" \
--exclude "LICENSE" \
-avh --no-perms . ~
# Reload the bash profile
source ~/.bash_profile
}
# Handle command-line arguments and confirmation
if [[ "$1" == "--force" || "$1" == "-f" ]]; then
update
else
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
unset -f update