1
0
chezmoi/home/.chezmoiscripts/run_onchange_10-install-packages.sh.tmpl

55 lines
1.2 KiB
Cheetah
Raw Normal View History

2024-01-20 21:28:01 +00:00
#!/usr/bin/env bash
set -euxo pipefail
packages=(
curl
wget
direnv
starship
tmux
unzip
zsh
2024-01-20 21:28:01 +00:00
)
2024-01-20 21:38:21 +00:00
{{ if (eq .chezmoi.osRelease.id "manjaro" "arch") -}}
2024-01-20 21:28:01 +00:00
echo -e "\033[0;32m>>>>> Begin 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 }}
2024-01-20 21:20:36 +00:00
fi
2024-01-20 21:28:01 +00:00
done
2024-01-09 19:50:02 +00:00
2024-01-20 21:28:01 +00:00
echo -e "\033[0;32m>>>>> Finish Manjaro Linux packages installation <<<<<\033[0m"
2024-01-20 21:20:36 +00:00
{{- end }}
2024-01-20 21:28:01 +00:00