tangled
alpha
login
or
join now
seth.computer
/
dotfiles
0
fork
atom
this repo has no description
0
fork
atom
overview
issues
pulls
pipelines
slightly nicer setup output
seth.computer
7 months ago
02beff57
6fa20322
verified
This commit was signed with the committer's
known signature
.
seth.computer
SSH Key Fingerprint:
SHA256:utUtG8j2hgvZ0Rnm/rPJiqFu4NT5bjOnC26AUIBh500=
+17
-10
1 changed file
expand all
collapse all
unified
split
setup.sh
+17
-10
setup.sh
···
2
2
3
3
set -euo pipefail
4
4
5
5
+
DOTFILES_DIR="$HOME/dotfiles"
6
6
+
5
7
function link_configs {
8
8
+
echo "Linking configuration files..."
9
9
+
6
10
declare -A mappings
7
11
8
12
# TODO: Make this linux compatible
···
17
21
mappings["misc/global-tool-versions"]="$HOME/.tool-versions"
18
22
19
23
for key in "${!mappings[@]}"; do
20
20
-
source="$PWD/${key}"
24
24
+
source="${key}"
21
25
destination="${mappings[$key]}"
22
26
23
27
if [ -d "$source" ]; then
···
35
39
local source="$1"
36
40
local destination="$2"
37
41
42
42
+
echo "$source -> $destination"
43
43
+
38
44
if [ -L "$destination" ]; then
39
39
-
if [ "$(readlink "$destination")" = "$source" ]; then
40
40
-
echo "Symlink $destination already points to $source, skipping."
45
45
+
if [ "$(readlink "$destination")" = "$DOTFILES_DIR/$source" ]; then
46
46
+
echo " Already established"
41
47
return
42
48
else
43
43
-
echo "Removing existing symlink $destination that points to $(readlink "$destination")."
49
49
+
echo " Removing existing symlink ($(readlink "$destination"))"
44
50
rm "$destination"
45
51
fi
46
52
fi
47
53
48
54
if [ -e "$destination" ]; then
49
49
-
echo "Destination $destination already exists and is not a symlink. Backing it up."
55
55
+
echo " Destination exists, backing it up"
50
56
mv "$destination" "${destination}.bak"
51
57
fi
52
58
53
53
-
echo "Creating symlink from $source to $destination."
54
54
-
ln -s "$source" "$destination"
59
59
+
echo " Creating symlink"
60
60
+
ln -s "$DOTFILES_DIR/$source" "$destination"
55
61
}
56
62
57
63
function install_oh_my_zsh {
58
58
-
if [ ! -d "$HOME/.oh-my-zsh" ]; then
59
59
-
echo "Installing oh my zsh..."
60
60
-
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
64
64
+
if [ -d "$HOME/.oh-my-zsh" ]; then
65
65
+
echo "Oh My Zsh is already installed."
66
66
+
return
61
67
fi
68
68
+
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
62
69
}
63
70
64
71
function install_tpm {