-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·94 lines (70 loc) · 2.46 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·94 lines (70 loc) · 2.46 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#! /usr/bin/env bash
# Set up the current user's account to use the files in src/ as their dotfiles.
platform="$(uname -s)"
dotfiles_dir=$(dirname "$0")
source "$dotfiles_dir"/lib/functions.sh
dotfiles_dir=$(abspath "$dotfiles_dir")
src_dir="$dotfiles_dir/src/"
bin_dir="$dotfiles_dir/bin"
config_dir="$dotfiles_dir/.config"
# Ensure commands in this repo are available for use while installing.
#
# We still execute some commands explicitly from $bin_dir to improve
# readability - this is mostly so commands we call can rely on other
# dotfiles/bin commands without doing their own PATH juggling.
PATH="$bin_dir:$PATH"
export PATH
mkdir -p "$HOME/.config"
config_files_to_install=$(cd "$dotfiles_dir" || exit; find src -maxdepth 1)
# We symlink individual subdirs so programs which make new ~/.config
# files aren't automatically creating new files in the git repo.
#
# When I want them, I'll explicitly add them.
config_dirs_to_install=$(cd "$dotfiles_dir" || exit; find .config -maxdepth 1)
"$bin_dir/install-crontab"
if command -v notmuch > /dev/null; then
install-notmuch-hooks
fi
for filename in $config_files_to_install;
do
filename="$(basename "$filename")"
target_path="$HOME/$filename"
if [ "$filename" == "." ] || [ "$filename" == ".." ]; then
continue
fi
if [ -e "$target_path" ]; then
echo "$target_path already exists. Not overwriting." >&2
else
target_dir=$(dirname "$target_path")
mkdir -p "$target_dir"
ln -s "$src_dir/$filename" "$target_path"
fi
done
for filename in $config_dirs_to_install; do
target_path="$HOME/$filename"
if [ -e "$target_path" ]; then
echo "$target_path already exists. Not overwriting." >&2
else
ln -s "$dotfiles_dir/$filename" "$HOME/$filename"
fi
done
if [ "$platform" == 'Darwin' ] ; then
"$bin_dir/setup-macos"
echo "OS X preferences set.
You will need to log out for all changes to take effect."
# FIXME Remove the following if no longer needed. It was for a
# now-quite-old macOS.
echo "Don't forget to run the following after installing Nix:
$bin_dir/fix-tmux-terminal-not-fully-functional-macos"
fi
if command -v gh >/dev/null; then
"$bin_dir"/install-gh-extensions
fi
# Install Anonymous Pro font.
#
# TODO Figure out if there's a way to check whether it's already installed.
open_binary=open
if [ "$platform" == "Linux" ]; then
open_binary=xdg-open
fi
$open_binary "$dotfiles_dir/anonymous-pro-font/"*.ttf