-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·99 lines (76 loc) · 3.01 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#! /usr/bin/env bash
echo "Checking and installing prereqs"
[[ -d "${HOME}/.oh-my-zsh" ]] ||
(echo "Oh My ZSH not found, installing..." &&
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)")
p10kdir="${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k"
[[ -d "${p10kdir}" ]] ||
(echo "Powerlevel10K not found, installing..." &&
git clone --depth=1 "https://github.com/romkatv/powerlevel10k.git" "${p10kdir}")
# Install fzf if not present
command -v "fzf" >"/dev/null" ||
(echo "FZF not found, installing..." &&
brew install fzf)
# Install ripgrep if not present
command -v "rg" >"/dev/null" ||
(echo "Ripgrep not found, installing..." &&
brew install ripgrep)
# Install terminal-notifier if not present
command -v "terminal-notifier" >"/dev/null" ||
(echo "terminal-notifier not found, installing..." &&
brew install terminal-notifier)
# Install eza if not present
command -v "eza" >"/dev/null" ||
(echo "eza not found, installing..." &&
brew install eza)
# Install libfido2 and related formulae if not present to support Yubikey/security key
libfido_installed=$(brew list | grep "^libfido2$")
[[ -z "${libfido_installed}" ]] &&
(echo "libfido2 not found, installing..." &&
brew install libfido2)
libsk_libfido_installed=$(brew list | grep "^libsk-libfido2$")
[[ -z "${libsk_libfido_installed}" ]] &&
(echo "libsk-libfido2 not found, installing..." &&
brew install libsk-libfido2)
libsk_libfido_install_installed=$(brew list | grep "^libsk-libfido2-install$")
[[ -z "${libsk_libfido_install_installed}" ]] &&
(echo "libsk-libfido2-install not found, installing..." &&
brew install michaelroosz/ssh/libsk-libfido2-install)
##
# END OF PRE-REQS
##
echo "Installing new configuration files."
echo "Installing .zshenv"
[[ -r "${HOME}/.zshenv" ]] &&
echo "Backing up your existing .zshenv to .zshenv.old" &&
mv "${HOME}/.zshenv" "${HOME}/.zshenv.old"
cp .zshenv "${HOME}/.zshenv"
echo "Installing .zprofile"
[[ -r "${HOME}/.zprofile" ]] &&
echo "Backing up your existing .zprofile to .zprofile.old" &&
mv "${HOME}/.zprofile" "${HOME}/.zprofile.old"
cp .zprofile "${HOME}/.zprofile"
echo "Installing .zshrc"
[[ -r "${HOME}/.zshrc" ]] &&
echo "Backing up your existing .zshrc to .zshrc.old" &&
mv "${HOME}/.zshrc" "${HOME}/.zshrc.old"
cp .zshrc "${HOME}/.zshrc"
echo "Installing .zsh directory"
[[ -r "${HOME}/.zsh" ]] &&
echo "Backing up your existing .zsh directory to .zsh.old" &&
rm -rf "${HOME}/.zsh.old" && mv "${HOME}/.zsh" "${HOME}/.zsh.old"
cp -R .zsh "${HOME}/.zsh"
# WIP Dry run diffing
# echo "Diffing configuration files."
# [[ -r "${HOME}/.zshenv" ]] &&
# (echo "Diffing .zshenv" &&
# diff .zshenv "${HOME}/.zshenv")
# [[ -r "${HOME}/.zprofile" ]] &&
# (echo "Diffing .zprofile" &&
# diff .zprofile "${HOME}/.zprofile")
# [[ -r "${HOME}/.zshrc" ]] &&
# (echo "Diffing .zshrc" &&
# diff .zshrc "${HOME}/.zshrc")
# [[ -r "${HOME}/.zsh" ]] &&
# (echo "Diffing .zsh directory" &&
# diff .zsh "${HOME}/.zsh")