1
0
chezmoi/home/.chezmoiscripts/run_onchange_10-install-packages.sh.tmpl
2024-02-25 21:17:45 +01:00

69 lines
1.5 KiB
Bash

#!/usr/bin/env bash
set -euxo pipefail
packages=(
curl
direnv
ranger
starship
tmux
trash-cli
unzip
wget
zip
zoxide
zsh
)
{{ if (eq .chezmoi.osRelease.id "manjaro" "arch") -}}
{{- /* we're on Arch based system */ -}}
echo -e "\033[0;32m>>>>> Begin Arch/Manjaro Linux packages installation <<<<<\033[0m"
## Update system
{{- if ne .chezmoi.username "root" }}
sudo pacman -Syu --noconfirm
{{- else }}
pacman -Syu --noconfirm
{{- end}}
## Install yay
if [ ! $(command -v yay) ]; then
echo "installing yay"
{{- if ne .chezmoi.username "root" }}
sudo pacman -S --needed --noconfirm git base-devel
{{- else}}
pacman -S --needed --noconfirm git base-devel
{{- end }}
git clone https://aur.archlinux.org/yay.git /tmp/yay
cd /tmp/yay
makepkg -si --noconfirm
rm -rf /tmp/yay
fi
## Install packages
for package in ${packages[@]}; do
if [ "$(yay -Qq $package 2> /dev/null)" != $package ]; then
echo "installing packages"
{{- if ne .chezmoi.username "root" }}
sudo yay -S --noconfirm $package
{{- else }}
yay -S --noconfirm $package
{{- end }}
fi
done
echo -e "\033[0;32m>>>>> Finish Arch/Manjaro Linux packages installation <<<<<\033[0m"
{{ else if (eq .chezmoi.osRelease.id "debian" "ubuntu") -}}
{{- /* we're on Debian based system */ -}}
echo -e "\033[0;32m>>>>> Begin Debian/Ubuntu Linux packages installation <<<<<\033[0m"
echo -e "\033[0;32m>>>>> Finish Debian/Ubuntu Linux packages installation <<<<<\033[0m"
{{- end }}