-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_onchange_install-packages.sh.tmpl
93 lines (78 loc) · 2.22 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
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
#!/usr/bin/env bash
# -*-mode:bash-*- vim:ft=bash
# -*-mode:go-template-*- vim:ft=bash
# ~/.local/share/chezmoi/run_onchange_install-packages.sh.tmpl
# =============================================================================
# Install packages based on the system.{{- /*
#
# This file supports Go's text/template language. */}}
source "{{ .chezmoi.sourceDir }}/script_utils.sh"
{{ $osid := .osid }}
{{ with .packages -}}
{{ if eq $osid "darwin" -}}
# Mac OS X installation of Homebrew packages
echo "${green}Installing Homebrew packages${reset}"
{{ if hasKey . "darwin" -}}
{{ with .darwin -}}
brew bundle --no-lock --file=/dev/stdin <<EOF
{{ range .brews -}}
brew {{ . | quote }}
{{ end -}}
{{ range .casks -}}
cask {{ . | quote }}
{{ end -}}
EOF
{{ end -}}
{{ end -}}
{{ else if eq $osid "linux-wolfi" -}}
{{ if hasKey . "wolfi" -}}
{{ with .wolfi -}}
brew bundle --no-lock --file=/dev/stdin <<EOF
{{ range .brews -}}
brew {{ . | quote }}
{{ end -}}
EOF
{{ end -}}
{{ end -}}
{{ else if eq $osid "fedora-workstation" -}}
# Fedora Workstation installation of packages
{{ if hasKey . "fedora_workstation" -}}
{{ with .fedora_workstation -}}
sudo dnf --quiet install -y dnf-plugins-core
{{ if hasKey . "repos" -}}
echo "${green}Adding external repositories${reset}"
{{ range .repos -}}
sudo dnf --quiet config-manager --add-repo {{ . | quote }}
{{ end -}}
{{ end -}}
{{ if hasKey . "copr" -}}
echo "${green}Adding Fedora COPR repositories${reset}"
{{ range .copr -}}
sudo dnf --quiet copr enable {{ . | quote }} -y &> /dev/null
{{ end -}}
{{ end -}}
{{ if hasKey . "groups" -}}
echo "${green}Installing Fedora groups${reset}"
{{ range .groups -}}
sudo dnf --quiet group install -y {{ . | quote }}
{{ end -}}
{{ end -}}
{{ if hasKey . "packages" -}}
echo "${green}Installing Fedora packages${reset}"
sudo dnf --quiet install -y {{ .packages | join " " }}
{{ end -}}
{{ end -}}
{{ end -}}
{{ else if eq $osid "linux-ubuntu" -}}
# Fedora Workstation installation of packages
{{ if hasKey . "ubuntu" -}}
{{ with .ubuntu -}}
{{ if hasKey . "packages" -}}
echo "${green}Installing Ubuntu packages${reset}"
sudo apt-get install -y {{ .packages | join " " }} &>/dev/null
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
# -*-mode:shellscript-*- vim:ft=bash: