2024-02-28 20:38:45 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
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-01 18:02:10 +00:00
|
|
|
printf " $(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-01 10:26:26 +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=(
|
|
|
|
starship
|
|
|
|
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-02-28 20:38:45 +00:00
|
|
|
packages=(${packages[@]//starship/})
|
|
|
|
|
|
|
|
## 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-01 10:47:05 +00:00
|
|
|
inf "installing starship..."
|
2024-02-28 20:38:45 +00:00
|
|
|
mist install starship-bin
|
|
|
|
|
|
|
|
{{- 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
|
|
|
|