-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·87 lines (67 loc) · 1.73 KB
/
setup.sh
File metadata and controls
executable file
·87 lines (67 loc) · 1.73 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
#!/bin/bash
set -euo pipefail
function linux_install_packages() {
local distro_id
source /etc/os-release
distro_id="$ID"
local packages
mapfile -t packages <arch/packages
case "$distro_id" in
arch | omarchy | cachyos)
export linux_stow_module="arch"
if command -v yay &>/dev/null; then
yay -S --noconfirm --needed "${packages[@]}"
elif command -v paru &>/dev/null; then
paru -S --noconfirm --needed "${packages[@]}"
else
sudo pacman -S --noconfirm --needed "${packages[@]}"
fi
;;
*)
echo "Error: ${distro_id} distribution not currently supported" >&2
exit 1
;;
esac
}
SYS_UNAME=$(uname -s)
readonly SYS_UNAME
if [[ "$SYS_UNAME" == "Linux" ]]; then
linux_install_packages
elif [[ "$SYS_UNAME" == "Darwin" ]] && ! command -v brew &>/dev/null; then
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
if [[ ! -d ~/dotfiles ]]; then
git clone https://github.com/mlhynfield/dotfiles.git ~/dotfiles
fi
pushd ~/dotfiles || exit 1
trap "popd || true" EXIT
git submodule update --init --recursive
if [[ "$SYS_UNAME" == "Darwin" ]]; then
brew bundle check --file=macos/Brewfile || brew bundle install --file=macos/Brewfile
rm -f ~/.zshrc
stow --adopt macos leaderkey hammerspoon
fi
if [[ -n "${linux_stow_module:-}" ]]; then
stow --adopt "$linux_stow_module"
fi
readonly NO_FOLD_STOW_MODULES=(
1password
)
stow --no-folding --adopt "${NO_FOLD_STOW_MODULES[@]}"
chmod 700 ~/.config/op
readonly STOW_MODULES=(
ghostty
git
github
k9s
nvim
scripts
task
tmux
vim
yazi
zsh
)
stow --adopt "${STOW_MODULES[@]}"
ya pkg install
git remote set-url origin git@github.com:mlhynfield/dotfiles.git