-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_once_after_00-set-env.sh.tmpl
116 lines (94 loc) · 4.21 KB
/
run_once_after_00-set-env.sh.tmpl
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/bin/bash
# include global vars and functions
source "${INCLUDES}"
{{ if eq .chezmoi.os "linux" -}}
{{ if eq .osid "linux-ubuntu" -}}
# install required APT packages
bdb_command "Installing Linux packages"
sudo apt update
sudo apt install -y $PACKAGES
# install ansible and terraform
sudo add-apt-repository --yes ppa:ansible/ansible
wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg > /dev/null
#gpg --no-default-keyring --keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg --fingerprint
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update
sudo apt install -y ansible terraform
{{ else if eq .osid "linux-debian" -}}
# install required APT packages
bdb_command "Installing Linux packages"
sudo apt update
sudo apt install -y $PACKAGES
# install ansible and terraform
UBUNTU_CODENAME=jammy
wget -O- "https://keyserver.ubuntu.com/pks/lookup?fingerprint=on&op=get&search=0x6125E2A8C77F2818FB7BD15B93C4A3FD7BB9C367" | sudo gpg --dearmour -o /usr/share/keyrings/ansible-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/ansible-archive-keyring.gpg] http://ppa.launchpad.net/ansible/ansible/ubuntu $UBUNTU_CODENAME main" | sudo tee /etc/apt/sources.list.d/ansible.list
wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo -- bash -c 'apt update && apt install -y ansible terraform'
bdb_success "installing Linux packages"
{{ else if eq .osid "linux-arch" -}}
# update the system and install required packages
bdb_command "Installing Linux packages"
sudo pacman -Syu --needed --noconfirm $PACKAGES
bdb_success "installing Linux packages"
{{ else if eq .osid "linux-fedora" -}}
# update the system and install required packages
bdb_command "Installing Linux packages"
sudo dnf -y upgrade && sudo dnf -y install $PACKAGES
# install terraform
sudo -- bash -c 'dnf install -y dnf-plugins-core && \
dnf config-manager --add-repo https://rpm.releases.hashicorp.com/fedora/hashicorp.repo && \
dnf -y install terraform'
bdb_success "installing Linux packages"
{{ end -}}
# update font cach to load manually installed fonts
bdb_run "Updating font cache"
fc-cache
bdb_outcome "done"
{{ else if eq .osid "darwin" -}}
# install Comman Line Tools if missing
bdb_run "Checking Xcode Command Line Tools"
if ! type xcode-select &>/dev/null || \
! clt_path="$(xcode-select --print-path &>/dev/null)" || \
! test -d "${clt_path}" || \
! test -x "${clt_path}"; then
bdb_outcome "missing"
bdb_command "Installing CLT"
sudo softwareupdate -i "$( sudo softwareupdate -l | \
grep '*.*Command Line' | \
awk -F ":" '{print $2}' | \
sed -e 's/^ *//' | \
tr -d '\n' \
)" --agree-to-license
bdb_success "installing CLT"
else
bdb_outcome "installed"
fi
# install Homebrew if missing
bdb_run "Checking Homebrew"
if ! type brew &>/dev/null; then
# install homebrew
bdb_outcome "missing"
bdb_command "Installing Homebrew"
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
bdb_success "installing Homebrew"
# install required packages
bdb_command "Installing Homebrew formulae"
brew bundle install --file=".config/homebrew/brewfile"
bdb_success "installing Homebrew formulae"
else
bdb_outcome "installed"
fi
{{ else if eq .osid "windows" -}}
{{ end -}}
# load bat colorscheme from ~/.config/bat/themes
bat cache --build
# set zsh as the login shell
bdb_run "Setting ZSH as default shell"
zsh_path="$(which zsh)"
if [[ "${SHELL}" != "${zsh_path}" ]]; then
echo "${zsh_path}" | sudo tee -a /etc/shells >/dev/null
sudo chsh -s "${zsh_path}" "${USER}"
fi
bdb_outcome "done"