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

71 lines
1.3 KiB
Bash

#!/usr/bin/env bash
# Logging function
log() {
printf "${C_BLU}>>>>> %s <<<<<${F_RST}" "$1"
}
# Testing existance function
exist() {
command -v "$1$" >/dev/null 2>&1
}
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 <<<<<"