-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·85 lines (61 loc) · 2.14 KB
/
install.sh
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
#! /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/"
# TODO Figure out why I didn't just symlink .config and be done with it. Seems
# like that should have worked?
config_dir="$dotfiles_dir/.config"
bin_dir="$dotfiles_dir/bin"
mkdir -p "$config_dir"
config_files_to_install=$(cd "$dotfiles_dir"; find src -maxdepth 1)
# TODO Make this a straight symlink to the .config folder? I don't understand
# why I didn't do that originally.
config_dirs_to_install=$(cd "$dotfiles_dir"; 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/set-os-x-defaults"
echo "OS X preferences set.
You will need to log out for all changes to take effect."
"$bin_dir/install-syncthing-launchd-job"
# FIXME This actually should happen on Linux, too.
echo "Don't forget to run the following after installing Nix:
$bin_dir/fix-tmux-terminal-not-fully-functional-macos
$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