-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·60 lines (49 loc) · 1.51 KB
/
install.sh
File metadata and controls
executable file
·60 lines (49 loc) · 1.51 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
#!/usr/bin/env bash
set -e
declare repo_dir
repo_dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
# go to repo directory
cd "$repo_dir"
# args
declare machine="$1"
if [[ -z "$machine" ]]; then
echo 'missing required argument: <machine>' >&2
echo ' - laptop-william' >&2
echo ' - work-william' >&2
echo ' - server-data' >&2
exit 1
fi
# umask
echo '==> configure umask'
# TODO: need a plugin for this
# TODO: do I even need the umask in ~/.shared_profile with this set?
if type 'launchctl' > /dev/null 2>&1; then
sudo launchctl config user umask 002
sudo launchctl config system umask 002
fi
umask 002
# install nk
curl -fsSL 'https://raw.githubusercontent.com/ciiqr/nk/HEAD/install.sh' | bash
# add to path
export PATH="${HOME}/.nk/bin:${PATH}"
# setup git hooks
if [[ "$(git rev-parse --is-inside-work-tree 2> /dev/null)" == "true" ]]; then
echo '==> setup git hooks'
git config --local core.hookspath .hooks
fi
# configure machine
echo '==> configure machine'
nk var set machine "$machine"
# clear quarantine attributes (when downloading zips, macos will quarantine the
# files, and any files extracted from them)
if type 'xattr' > /dev/null 2>&1; then
# TODO: don't use grep
# TODO: find sources in .nk.yml file
if xattr -r . ../dotfiles-private | grep -q com.apple.quarantine; then
# TODO: only run on sources that exist
xattr -r -d com.apple.quarantine . ../dotfiles-private || true
fi
fi
# provision
echo '==> provision'
nk provision --show-unchanged