From 1bba28bc3faf92f64d28cfcb01296709ecb20c84 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Tue, 10 May 2022 16:29:56 -0600 Subject: [PATCH] add .osid trick --- .chezmoi.toml.tmpl | 8 ++++++++ run_once_install.sh.tmpl | 10 +++------- 2 files changed, 11 insertions(+), 7 deletions(-) create mode 100644 .chezmoi.toml.tmpl diff --git a/.chezmoi.toml.tmpl b/.chezmoi.toml.tmpl new file mode 100644 index 0000000..a6b8e59 --- /dev/null +++ b/.chezmoi.toml.tmpl @@ -0,0 +1,8 @@ +{{- $osid := .chezmoi.os -}} +{{- if hasKey .chezmoi.osRelease "id" -}} +{{- $osid = printf "%s-%s" .chezmoi.os .chezmoi.osRelease.id -}} +{{- end -}} + +[data] + osid = {{ $osid | quote }} + diff --git a/run_once_install.sh.tmpl b/run_once_install.sh.tmpl index 6d26d49..b1f5b19 100644 --- a/run_once_install.sh.tmpl +++ b/run_once_install.sh.tmpl @@ -1,16 +1,12 @@ #!/usr/bin/env sh echo "Running installation script\n" -{{- if eq .chezmoi.os "linux" }} -{{- if hasKey .chezmoi.osRelease "id" }} # avoid M1 mac osRelease.id not exist -{{- if eq .chezmoi.osRelease.id "alpine" }} +{{- if eq .osid "linux-alpine" }} apk update apk add zsh tmux perl bash -{{- else if (or (eq .chezmoi.osRelease.id "debian") (eq .chezmoi.osRelease.id "ubuntu")) }} +{{- else if (or (eq .osid "debian") (eq .osid "ubuntu")) }} sudo apt update sudo apt install zsh tmux perl bash -y -{{- end }} -{{- end }} -{{- else if eq .chezmoi.os "darwin" }} +{{- else if eq .osid "darwin" }} brew install neovim zsh tmux perl {{- end }} # curl -sS https://webinstall.dev/webi | bash