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

128 lines
4.2 KiB
Cheetah
Raw Normal View History

2024-01-20 21:28:01 +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"
2024-03-01 10:26:26 +00:00
}
2024-02-28 20:38:45 +00:00
2024-03-01 10:47:05 +00:00
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:47:05 +00:00
}
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=(
2024-03-06 17:37:48 +00:00
bubblewrap
2024-02-28 20:38:45 +00:00
curl
direnv
2024-03-01 11:42:37 +00:00
pass
2024-03-01 16:47:53 +00:00
libyaml
2024-02-28 20:38:45 +00:00
ranger
tmux
trash-cli
2024-03-01 18:51:08 +00:00
ueberzug
2024-02-28 20:38:45 +00:00
unzip
wget
zip
zoxide
)
2024-01-20 21:28:01 +00:00
2024-03-03 14:49:17 +00:00
2024-01-20 21:38:21 +00:00
{{ if (eq .chezmoi.osRelease.id "manjaro" "arch") -}}
2024-02-25 20:17:45 +00:00
2024-03-01 11:02:30 +00:00
log "Begin Arch/Manjaro Linux packages installation"
2024-01-20 21:28:01 +00:00
## Update system
2024-03-01 10:47:05 +00:00
inf "updating system..."
2024-01-20 21:28:01 +00:00
{{- if ne .chezmoi.username "root" }}
2024-03-01 11:02:30 +00:00
sudo pacman -Syu --noconfirm --quiet
2024-01-20 21:28:01 +00:00
{{- else }}
2024-03-01 11:02:30 +00:00
pacman -Syu --noconfirm --quiet
2024-01-20 21:28:01 +00:00
{{- end}}
## Install yay
2024-03-01 10:27:56 +00:00
if [ ! $(command -v yay) ]; then
2024-03-01 10:47:05 +00:00
inf "installing yay..."
2024-02-28 20:38:45 +00:00
{{- if ne .chezmoi.username "root" }}
2024-03-01 11:02:30 +00:00
sudo pacman -S --needed --noconfirm --quiet git base-devel
2024-02-28 20:38:45 +00:00
{{- else}}
2024-03-01 11:02:30 +00:00
pacman -S --needed --noconfirm --quiet git base-devel
2024-02-28 20:38:45 +00:00
{{- end }}
2024-01-20 21:28:01 +00:00
git clone https://aur.archlinux.org/yay.git /tmp/yay
cd /tmp/yay
makepkg -si --noconfirm
rm -rf /tmp/yay
fi
## Install packages
2024-02-28 20:38:45 +00:00
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-04-10 22:04:33 +00:00
yay -S --noconfirm --removemake --quiet $package
2024-02-28 20:38:45 +00:00
fi
done
2024-01-09 19:50:02 +00:00
2024-03-01 11:02:30 +00:00
log "Finish Arch/Manjaro Linux packages installation"
2024-02-25 20:17:45 +00:00
{{ else if (eq .chezmoi.osRelease.id "debian" "ubuntu") -}}
2024-03-01 11:02:30 +00:00
log "Begin Debian/Ubuntu Linux packages installation"
2024-02-25 20:17:45 +00:00
2024-03-01 11:46:05 +00:00
export DEBIAN_FRONTEND=noninteractive
2024-02-27 15:39:55 +00:00
2024-02-27 09:42:25 +00:00
## Add repositories and update system
2024-03-01 10:47:05 +00:00
inf "updating system..."
2024-02-26 19:23:16 +00:00
{{- if ne .chezmoi.username "root" }}
2024-03-01 11:02:30 +00:00
sudo -E apt-get install --yes --no-install-recommends --ignore-missing -qq lsb-release gpg
2024-02-27 10:06:03 +00:00
curl -fsSL 'https://proget.makedeb.org/debian-feeds/makedeb.pub' | gpg --dearmor | sudo tee /usr/share/keyrings/makedeb-archive-keyring.gpg 1> /dev/null
2024-02-27 09:42:25 +00:00
echo 'deb [signed-by=/usr/share/keyrings/makedeb-archive-keyring.gpg arch=all] https://proget.makedeb.org/ makedeb main' | sudo tee /etc/apt/sources.list.d/makedeb.list
2024-02-27 13:23:36 +00:00
curl -fsSL 'https://proget.makedeb.org/debian-feeds/prebuilt-mpr.pub' | gpg --dearmor | sudo tee /usr/share/keyrings/prebuilt-mpr-archive-keyring.gpg 1> /dev/null
echo "deb [arch=all,$(dpkg --print-architecture) signed-by=/usr/share/keyrings/prebuilt-mpr-archive-keyring.gpg] https://proget.makedeb.org prebuilt-mpr $(lsb_release -cs)" | sudo tee /etc/apt/sources.list.d/prebuilt-mpr.list
2024-03-01 11:02:30 +00:00
sudo -E apt update -qq
sudo -E apt upgrade --yes -qq
2024-03-01 12:39:14 +00:00
sudo -E apt-get install --yes --no-install-recommends --ignore-missing --fix-broken -qq mist
2024-02-26 19:23:16 +00:00
{{- else }}
2024-03-01 11:02:30 +00:00
apt-get install --yes --no-install-recommends --ignore-missing -qq lsb-release gpg
2024-02-27 10:06:03 +00:00
curl -fsSL 'https://proget.makedeb.org/debian-feeds/makedeb.pub' | gpg --dearmor | tee /usr/share/keyrings/makedeb-archive-keyring.gpg 1> /dev/null
2024-02-27 09:42:25 +00:00
echo 'deb [signed-by=/usr/share/keyrings/makedeb-archive-keyring.gpg arch=all] https://proget.makedeb.org/ makedeb main' | tee /etc/apt/sources.list.d/makedeb.list
2024-02-27 13:23:36 +00:00
curl -fsSL 'https://proget.makedeb.org/debian-feeds/prebuilt-mpr.pub' | gpg --dearmor | tee /usr/share/keyrings/prebuilt-mpr-archive-keyring.gpg 1> /dev/null
echo "deb [arch=all,$(dpkg --print-architecture) signed-by=/usr/share/keyrings/prebuilt-mpr-archive-keyring.gpg] https://proget.makedeb.org prebuilt-mpr $(lsb_release -cs)" | tee /etc/apt/sources.list.d/prebuilt-mpr.list
2024-03-01 11:02:30 +00:00
apt update -qq
apt upgrade --yes -qq
2024-03-01 12:39:14 +00:00
apt-get install --yes --no-install-recommends --ignore-missing --fix-broken -qq mist
2024-02-26 19:23:16 +00:00
{{- end}}
2024-02-27 14:40:01 +00:00
mist update
2024-02-26 19:23:16 +00:00
## Install packages
2024-03-01 16:47:53 +00:00
packages=(${packages[@]/starship/makedeb})
packages=(${packages[@]/libyaml/libyaml-dev})
2024-03-01 12:47:07 +00:00
packages+=(
apt-utils
autoconf
automake
cmake
doxygen
2024-03-01 16:39:47 +00:00
libffi-dev
2024-03-01 12:47:07 +00:00
libtool
libtool-bin
ninja-build
pkg-config
2024-03-01 16:39:47 +00:00
zlib1g-dev
2024-03-01 12:47:07 +00:00
)
2024-02-28 20:38:45 +00:00
for package in ${packages[@]}; do
2024-03-01 10:47:05 +00:00
inf "installing ${package}..."
2024-02-28 20:38:45 +00:00
2024-02-26 19:23:16 +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-26 19:23:16 +00:00
{{- end }}
2024-02-28 20:38:45 +00:00
done
2024-02-27 09:39:00 +00:00
2024-03-01 11:02:30 +00:00
log "Finish Debian/Ubuntu Linux packages installation"
2024-02-25 20:17:45 +00:00
2024-01-20 21:20:36 +00:00
{{- end }}
2024-01-20 21:28:01 +00:00