1
0
chezmoi/home/.chezmoiscripts/run_once_after_40-install-shell.sh.tmpl
Jeff LANCE 5c97f5d824 Up.
2024-04-10 23:59:18 +02:00

104 lines
2.0 KiB
Bash

#!/usr/bin/env bash
# Load asdf
# as we need cargo and it is installed from
. "$HOME/.asdf/asdf.sh"
# Logging function
log() {
printf "$(tput setaf 4)$(tput bold)>>>>> %s <<<<<$(tput sgr0)\n" "$1"
}
inf() {
printf "$(tput setaf 2)╚═══ᐳ $(tput sgr 0 1)$(tput setaf 2)%s$(tput sgr0)\n" "$1"
}
# Environment variables
ZIMDIR=${HOME}/.zim
# Packages to install
packages=(
zsh
)
### Install Zsh ###
log "Begin Zsh installation"
{{ if (eq .chezmoi.osRelease.id "manjaro" "arch") -}}
## Update system
inf "updating system..."
yay -Syu --noconfirm --quiet
## install packages
for package in ${packages[@]}; do
if [ "$(yay -Qq $package 2> /dev/null)" != $package ]; then
inf "installing ${package}..."
yay -S --noconfirm --quiet $package
fi
done
{{ else if (eq .chezmoi.osRelease.id "debian" "ubuntu") -}}
export DEBIAN_FRONTEND=noninteractive
## Update system
inf "updating system..."
{{- if ne .chezmoi.username "root" }}
sudo -E apt update -qq
sudo -E apt upgrade --yes -qq
{{- else }}
apt update -qq
apt upgrade --yes -qq
{{- end}}
## packages=(${packages[@]//starship/})
## install packages
for package in ${packages[@]}; do
inf "installing ${package}..."
{{- if ne .chezmoi.username "root" }}
sudo -E apt-get install --yes --no-install-recommends --ignore-missing --fix-broken -qq $package
{{- else }}
apt-get install --yes --no-install-recommends --ignore-missing --fix-broken -qq $package
{{- end }}
done
## inf "installing starship..."
## mist install starship-bin
{{- end }}
log "Finish Zsh installation"
## Update cargo
log "Installing cargo-update"
cargo install cargo-update
log "Finish cargo-update installation"
## Install Atuin
log "Installing atuin"
cargo install atuin
ln -s ~/.asdf/installs/rust/1.76.0/bin/atuin .asdf/shims/atuin
log "Finish atuin installation"
### Config Zsh ###
log "Installing Zim Framework"
$(which zsh) -c "source ${ZIMDIR}/zimfw.zsh init -q"
log "Finish zsh installation"