-
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix installation of template pre-requisites (#114)
- Loading branch information
Showing
10 changed files
with
105 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
# This script must exit as fast as possible when pre-requisites are already | ||
# met, so we only import the scripts-library when we really need it. | ||
|
||
set -eu | ||
|
||
wanted_packages=( | ||
git # used to find the latest revisions of github repositories | ||
curl # used to find the latest version of github repositories | ||
zsh | ||
) | ||
|
||
missing_packages=() | ||
|
||
for package in "${wanted_packages[@]}"; do | ||
if ! command -v "${package}" >/dev/null; then | ||
missing_packages+=("${package}") | ||
fi | ||
done | ||
|
||
if [[ ${#missing_packages[@]} -eq 0 ]]; then | ||
exit 0 | ||
fi | ||
|
||
# shellcheck source=../.chezmoitemplates/scripts-library | ||
source "${CHEZMOI_SOURCE_DIR?}/.chezmoitemplates/scripts-library" | ||
|
||
log_task "Installing missing packages with APT: ${missing_packages[*]}" | ||
|
||
c sudo apt update | ||
c sudo apt install --yes --no-install-recommends "${missing_packages[@]}" |
36 changes: 0 additions & 36 deletions
36
home/.chezmoiscripts/run_before_30-install-prerequisites.sh.tmpl
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,28 @@ | ||
{{- $chezmoiData := deepCopy . -}} | ||
{{- $chezmoiData = unset $chezmoiData "chezmoi" -}} | ||
|
||
sourceDir: "{{ joinPath .chezmoi.workingTree "root" }}" | ||
{{- $sourceDir := joinPath .chezmoi.workingTree "root" -}} | ||
sourceDir: "{{ $sourceDir }}" | ||
|
||
destDir: "/" | ||
|
||
verbose: true | ||
|
||
# https://github.com/twpayne/chezmoi/issues/3257 | ||
pager: "" | ||
|
||
diff: | ||
exclude: | ||
- scripts | ||
status: | ||
exclude: | ||
- always | ||
|
||
hooks: | ||
read-source-state: | ||
pre: | ||
command: {{ $sourceDir }}/.chezmoihooks/ensure-pre-requisites.sh | ||
|
||
data: | ||
non_root_user: "{{ .chezmoi.username }}" | ||
{{ $chezmoiData | toYaml | indent 2 }} | ||
{{- $chezmoiData | toYaml | nindent 2 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
# This script must exit as fast as possible when pre-requisites are already | ||
# met, so we only import the scripts-library when we really need it. | ||
|
||
set -eu | ||
|
||
wanted_packages=( | ||
gpg # used to decrypt the gpg keys of the apt repositories | ||
) | ||
|
||
missing_packages=() | ||
|
||
for package in "${wanted_packages[@]}"; do | ||
if ! command -v "${package}" >/dev/null; then | ||
missing_packages+=("${package}") | ||
fi | ||
done | ||
|
||
if [[ ${#missing_packages[@]} -eq 0 ]]; then | ||
exit 0 | ||
fi | ||
|
||
# shellcheck source=../.chezmoitemplates/scripts-library | ||
source "${CHEZMOI_SOURCE_DIR?}/.chezmoitemplates/scripts-library" | ||
|
||
log_task "Installing missing packages with APT: ${missing_packages[*]}" | ||
|
||
c apt update | ||
c apt install --yes --no-install-recommends "${missing_packages[@]}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
root/.chezmoiscripts/run_before_10-install-prerequisites.sh.tmpl
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters