1
0
chezmoi/home/.chezmoiscripts/run_onchange_after_20-config-zim.sh.tmpl
2024-03-01 11:37:17 +01:00

65 lines
1.3 KiB
Bash

#!/usr/bin/env bash
# Logging function
log() {
printf "$(tput setaf 4)$(tput bold)>>>>> %s <<<<<$(tput sgr0)" "$1"
}
# Environment variables
ZIMDIR=${HOME}/.zim:
# Packages to install
packages=(
starship
zsh
)
### Install Zsh ###
log ">>>>> Begin Zsh installation <<<<<"
{{ if (eq .chezmoi.osRelease.id "manjaro" "arch") -}}
## install packages
for package in ${packages[@]}; do
if [ "$(yay -Qq $package 2> /dev/null)" != $package ]; then
log "installing ${package}..."
yay -S --noconfirm $package
fi
done
{{ else if (eq .chezmoi.osRelease.id "debian" "ubuntu") -}}
DEBIAN_FRONTEND=noninteractive
packages=(${packages[@]//starship/})
## install packages
for package in ${packages[@]}; do
log "installing ${package}..."
{{- if ne .chezmoi.username "root" }}
sudo -E apt-get install --yes --no-install-recommends --ignore-missing $package
{{- else }}
apt-get install --yes --no-install-recommends --ignore-missing $package
{{- end }}
done
log "installing starship..."
mist install starship-bin
{{- end }}
log ">>>>> Finish Zsh installation <<<<<"
### Config Zsh ###
log ">>>>> Installing Zim Framework <<<<<"
$(which zsh) -c "source ${ZIMDIR}/zimfw.zsh init -q"
log ">>>>> Finish zsh installation <<<<<"