1
0
chezmoi/home/.chezmoiscripts/run_onchange_after_20-prepare-shell.sh.tmpl

95 lines
1.9 KiB
Cheetah
Raw Normal View History

2024-02-28 20:38:45 +00:00
#!/usr/bin/env bash
2024-03-03 15:12:42 +00:00
# Load asdf
# as we need cargo and it is installed from
. "$HOME/.asdf/asdf.sh"
2024-03-01 10:26:26 +00:00
# Logging function
log() {
2024-03-01 10:47:05 +00:00
printf "$(tput setaf 4)$(tput bold)>>>>> %s <<<<<$(tput sgr0)\n" "$1"
}
inf() {
2024-03-03 14:12:40 +00:00
printf "$(tput setaf 2)╚═══ᐳ $(tput sgr 0 1)$(tput setaf 2)%s$(tput sgr0)\n" "$1"
2024-03-01 10:26:26 +00:00
}
2024-02-28 20:38:45 +00:00
2024-03-01 10:37:17 +00:00
# Environment variables
2024-03-03 16:05:53 +00:00
ZIMDIR=${HOME}/.zim
2024-02-28 20:38:45 +00:00
2024-03-01 10:26:26 +00:00
# Packages to install
2024-02-28 20:38:45 +00:00
packages=(
zsh
)
### Install Zsh ###
2024-03-01 11:02:30 +00:00
log "Begin Zsh installation"
2024-02-28 20:38:45 +00:00
{{ if (eq .chezmoi.osRelease.id "manjaro" "arch") -}}
2024-03-01 10:47:05 +00:00
## Update system
inf "updating system..."
2024-03-01 11:02:30 +00:00
yay -Syu --noconfirm --quiet
2024-03-01 10:47:05 +00:00
2024-02-28 20:38:45 +00:00
## install packages
for package in ${packages[@]}; do
if [ "$(yay -Qq $package 2> /dev/null)" != $package ]; then
2024-03-01 10:47:05 +00:00
inf "installing ${package}..."
2024-03-01 11:02:30 +00:00
yay -S --noconfirm --quiet $package
2024-02-28 20:38:45 +00:00
fi
done
{{ else if (eq .chezmoi.osRelease.id "debian" "ubuntu") -}}
2024-03-01 11:46:05 +00:00
export DEBIAN_FRONTEND=noninteractive
2024-02-28 20:38:45 +00:00
2024-03-01 10:47:05 +00:00
## Update system
inf "updating system..."
{{- if ne .chezmoi.username "root" }}
2024-03-01 11:02:30 +00:00
sudo -E apt update -qq
sudo -E apt upgrade --yes -qq
2024-03-01 10:47:05 +00:00
{{- else }}
2024-03-01 11:02:30 +00:00
apt update -qq
apt upgrade --yes -qq
2024-03-01 10:47:05 +00:00
{{- end}}
2024-03-03 14:51:37 +00:00
## packages=(${packages[@]//starship/})
2024-02-28 20:38:45 +00:00
## install packages
for package in ${packages[@]}; do
2024-03-01 10:47:05 +00:00
inf "installing ${package}..."
2024-02-28 20:38:45 +00:00
{{- if ne .chezmoi.username "root" }}
2024-03-01 12:39:14 +00:00
sudo -E apt-get install --yes --no-install-recommends --ignore-missing --fix-broken -qq $package
2024-02-28 20:38:45 +00:00
{{- else }}
2024-03-01 12:39:14 +00:00
apt-get install --yes --no-install-recommends --ignore-missing --fix-broken -qq $package
2024-02-28 20:38:45 +00:00
{{- end }}
done
2024-03-03 14:51:37 +00:00
## inf "installing starship..."
## mist install starship-bin
2024-02-28 20:38:45 +00:00
{{- end }}
2024-03-01 11:02:30 +00:00
log "Finish Zsh installation"
2024-02-28 20:38:45 +00:00
### Config Zsh ###
2024-03-01 11:02:30 +00:00
log "Installing Zim Framework"
2024-02-28 20:38:45 +00:00
$(which zsh) -c "source ${ZIMDIR}/zimfw.zsh init -q"
2024-03-01 11:02:30 +00:00
log "Finish zsh installation"
2024-02-28 20:38:45 +00:00
2024-03-03 12:23:46 +00:00
## Install Atuin
2024-03-03 14:57:18 +00:00
log "Installing atuin"
2024-03-03 12:23:46 +00:00
bash <(curl --proto '=https' --tlsv1.2 -sSf https://setup.atuin.sh)
2024-03-03 14:57:18 +00:00
log "Finish atuin installation"
2024-03-03 12:23:46 +00:00