-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbootstrap
executable file
·62 lines (50 loc) · 1.61 KB
/
bootstrap
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
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env zsh
() {
# Get the current execution context and move into it
SCRIPT_DIR=$(cd $(dirname "${(%):-%x}") && pwd)
cd $SCRIPT_DIR || return
# Source commons (e.g. logging)
for libraryFile (_lib/*.zsh); do
source $libraryFile
done
ensure_env
# Pull in the latest dotfiles
logger "info" "Pulling latest files from remote ..."
if ! git pull origin main >/dev/null 2>&1
then
logger "warning" "Failed to pull in latest files from source!"
else
logger "success" "Successfully pulled in latest files."
fi
prompt "This may overwrite existing files in your home directory ..."
if (( $PROMPT_PROCEED != 0 )); then
return
fi
# Use GNU Stow to link up dotfiles
mkdir -p $HOME/.config
if ! stow -t $HOME stow git mackup prefs tmux zsh >/dev/null 2>&1; then
logger "error" "Failed to link dotfiles!"
exit 1
fi
if ! stow -t $HOME/.config config >/dev/null 2>&1; then
logger "error" "Failed to link dotfiles!"
exit 1
fi
# Fix any permission issues related to loading auto-completion
for dir in $(compaudit 2>/dev/null); do
chmod g-w $dir
done
logger "success" "Successfully linked dotfiles."
logger "info" "Installing Starship ..."
if [[ $(/usr/bin/uname -m) == "arm64" ]]; then
export STARSHIP_LOCATION="/opt/starship/bin"
else
export STARSHIP_LOCATION="/usr/local/bin"
fi
sudo mkdir -p $STARSHIP_LOCATION
curl -sS https://starship.rs/install.sh | sh -s -- -b $STARSHIP_LOCATION -y >/dev/null
unset STARSHIP_LOCATION
logger "success" "Successfully installed Starship."
# Replace the shell instance with a new one
exec zsh -l
}