-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·99 lines (75 loc) · 1.84 KB
/
install.sh
File metadata and controls
executable file
·99 lines (75 loc) · 1.84 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
95
96
97
98
99
#!/usr/bin/env bash
set -eo pipefail
# Parse flags
for arg in "$@"; do
case "$arg" in
--yes|-y) export DOTPICKLES_YES=1 ;;
esac
done
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export DIR
# Ensure ~/.pickles points to this repo, even if cloned elsewhere (e.g. devcontainers)
if [[ "$DIR" != "$HOME/.pickles" ]] && [[ ! -e "$HOME/.pickles" ]]; then
ln -s "$DIR" "$HOME/.pickles"
echo "🔗 Symlinked ~/.pickles -> $DIR"
fi
if [[ -f .env ]]; then
source .env
fi
if [[ -z "${DOTPICKLES_ROLE}" ]]; then
if hostname=$(hostnamectl hostname 2> /dev/null); then
:
else
hostname=$(hostname)
fi
if [[ "$hostname" =~ ^josh-nichols- ]]; then
DOTPICKLES_ROLE="work"
else
DOTPICKLES_ROLE="personal"
fi
fi
export DOTPICKLES_ROLE
echo "role: $DOTPICKLES_ROLE"
# shellcheck source=./functions.sh
source ./functions.sh
# Guard: non-interactive without --yes is an error
if [ "${DOTPICKLES_YES:-}" != "1" ] && [ ! -t 0 ]; then
echo "Error: not running interactively. Use --yes/-y for unattended mode." >&2
exit 1
fi
if running_macos; then
# Prevent sleeping during script execution, as long as the machine is on AC power
caffeinate -s -w $$ &
fi
if running_macos; then
load_brew_shellenv
if ! brew_available; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
load_brew_shellenv
fi
brew_bundle
fi
git submodule init
git submodule update
link_directory_contents home
mkdir -p "$HOME/.config"
link_directory_contents config
echo
./gitconfig.sh
./sshconfig.sh
if running_macos; then
echo "🍎 configuring macOS defaults"
~/.macos
echo
echo "🔐 configuring SSH to use keychain"
ssh-add --apple-load-keychain
# ./gh-shorthand.sh
fi
if ! running_codespaces; then
# ./vim.sh
./tmux.sh
./fish.sh
./bash.sh
./skills.sh
fi
echo "✅ Done"