forked from tbjers/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_onchange_install-packages.sh.tmpl
45 lines (42 loc) · 1.42 KB
/
run_onchange_install-packages.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
#!/usr/bin/env bash
source "{{ .chezmoi.sourceDir }}/script_utils.sh"
{{ if eq .osid "darwin" -}}
# Mac OS X installation of Homebrew packages
echo "${green}Installing Homebrew packages${reset}"
brew bundle --no-lock --file=/dev/stdin <<EOF
{{ range .packages.darwin.brews -}}
brew {{ . | quote }}
{{ end -}}
{{ range .packages.darwin.casks -}}
cask {{ . | quote }}
{{ end -}}
EOF
{{ else if eq .osid "linux-fedora" -}}
# Fedora installation of packages
{{ if hasKey .packages "linux_fedora" -}}
sudo dnf --quiet install -y dnf-plugins-core
{{ if hasKey .packages.linux_fedora "repos" -}}
echo "${green}Adding external repositories${reset}"
{{ range .packages.linux_fedora.repos -}}
sudo dnf --quiet config-manager --add-repo {{ . | quote }}
{{ end -}}
{{ end -}}
{{ if hasKey .packages.linux_fedora "copr" -}}
echo "${green}Adding Fedora COPR repositories${reset}"
{{ range .packages.linux_fedora.copr -}}
sudo dnf --quiet copr enable {{ . | quote }} -y &> /dev/null
{{ end -}}
{{ end -}}
{{ if hasKey .packages.linux_fedora "groups" -}}
echo "${green}Installing Fedora groups${reset}"
{{ range .packages.linux_fedora.groups -}}
sudo dnf --quiet group install -y {{ . | quote }}
{{ end -}}
{{ end -}}
{{ if hasKey .packages.linux_fedora "packages" -}}
echo "${green}Installing Fedora packages${reset}"
sudo dnf --quiet install -y {{ .packages.linux_fedora.packages | join " " }}
{{ end -}}
{{ end -}}
{{ end -}}
# -*-mode:shellscript-*- vim:ft=bash: