-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall
More file actions
executable file
·67 lines (51 loc) · 1.82 KB
/
Copy pathinstall
File metadata and controls
executable file
·67 lines (51 loc) · 1.82 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
# set -x
# REMINDER: if you want to reestablish links to configs on an already installed
# environment, run:
# stow configs --adopt [--simulate -vvv]
set -e
{ #prevent exec until fully downloaded
CWD=$(dirname -- "$(readlink -f -- "$0")")
DIR=~/.dotfiles
HOME=~/
#region get dotfiles
if [ "$CODESPACES" = true ]; then
echo "Running in codespaces..."
DIR="/workspaces/.codespaces/.persistedshare/dotfiles"
fi
if [ ! -d $DIR ]; then
git clone https://github.com/jsg2021/dotfiles.git $DIR
cd $DIR
# git submodule update --init --recursive
fi
# When piped (curl | bash) $0 is not a real path, so $CWD is junk.
# The clone above guarantees $DIR, so fall back to it.
if [ ! -f "$CWD/scripts/installers/helpers" ]; then
CWD="$DIR"
fi
# Everything below (git checks, stow's .stowrc) assumes we sit in the repo.
cd $CWD
source $CWD/scripts/installers/helpers
#endregion
if ! is_git_clean; then
echo "Git repository is not clean. Please commit or stash changes before installing configs."
exit 1
fi
#region tools
if [ "$CODESPACES" = true ]; then
echo "Running in codespaces...skip dev os setup"
else
variant=$(uname -s | awk '{print tolower($0)}');
"$CWD/scripts/installers/$variant";
fi
#endregion
# use adopt to prevent stow from complaining about existing files,
# since we are going to reset hard anyway
stow --dir="$CWD" --target="$HOME" configs --adopt # -vvv
if ! is_git_clean; then
echo -e "\n\nStashing old .dotfiles that we just replaced... inspect the stash and recover or drop as needed.\n\n";
git stash --include-untracked
fi
"$CWD/scripts/installers/set-zsh"
echo "Installation complete!"
}