profile/packages/packages.sh

175 lines
2.7 KiB
Bash
Raw Normal View History

2018-02-18 00:12:28 +00:00
#!/bin/sh -e
2018-02-17 19:12:09 +00:00
2018-02-17 19:31:58 +00:00
. ./os.sh
2018-02-17 19:12:09 +00:00
apt_install() {
2018-02-17 19:38:24 +00:00
DEBIAN_FRONTEND="noninteractive" sudo apt-get install -y "$@"
2018-02-17 19:12:09 +00:00
}
pacman_install() {
sudo pacman -S --noconfirm --needed "$@"
}
yay_install() {
packages=""
for package in "$@"; do
if ! pacman -Q "${package}" >/dev/null 2>&1; then
packages="${packages} ${package}"
fi
done
if [ ! -z "${packages}" ]; then
yay -S --noconfirm --needed ${packages}
fi
for package in "$@"; do
if ! pacman -Q "${package}" >/dev/null 2>&1; then
return 1 # at least one of the packages has not been correctly installed!
fi
done
return 0
2018-02-17 19:12:09 +00:00
}
pacaur_install() {
pacaur -S --noconfirm --needed "$@"
}
yaourt_install() {
yaourt -S --noconfirm --needed "$@"
}
pip3_install() {
pip3 install --ignore-installed --user -U "$@"
2018-02-17 19:12:09 +00:00
}
2019-11-22 09:22:54 +00:00
pipx_install() {
for pkg in "$@"
do
pipx install --force "$pkg"
done
}
download() {
curl -L "$@"
}
2018-02-17 19:12:09 +00:00
###
# Actual package installation code from here
# macOS brew
if has_tags pm:brew; then
brew update
brew install \
coreutils \
libarchive \
2018-07-17 13:27:18 +00:00
gnu-tar \
gzip \
xz \
jq \
git \
gnupg \
md5sha1sum \
rxvt-unicode \
zsh \
zsh-syntax-highlighting
fi
2018-02-17 19:12:09 +00:00
# Arch Linux
if has_tags pm:pacman; then
# libarchive for bsdtar
sudo pacman -Sy
2018-02-17 19:12:09 +00:00
pacman_install \
base-devel \
libarchive \
tar \
gzip \
2018-02-17 19:19:37 +00:00
xz \
jq \
2018-02-19 09:48:46 +00:00
git \
gnupg
2018-02-17 19:12:09 +00:00
# yay
if ! has_tags pm:yay; then
if has_tags pacaur; then
pacaur_install yay
elif has_tags yaourt; then
yaourt_install yay
else
(
dir="$(mktemp -d)"
cd "${dir}"
download https://aur.archlinux.org/cgit/aur.git/snapshot/yay.tar.gz | tar -xz --strip=1
2018-02-17 19:12:09 +00:00
makepkg -sri --noconfirm
cd
rm -rf "${dir}"
)
fi
add_tag pm:yay
fi
# from here on we should have yay available
yay_install \
2021-10-09 20:42:47 +00:00
customizepkg-git \
2018-02-17 19:12:09 +00:00
zsh \
2020-09-30 08:03:22 +00:00
zsh-syntax-highlighting \
logo-ls
2018-02-17 19:12:09 +00:00
if has_tags desktop; then
yay_install \
powerline-fonts \
2020-09-30 07:12:04 +00:00
ttf-nerd-fonts-symbols \
2021-06-01 08:14:51 +00:00
ttf-fira-code
2018-02-17 19:12:09 +00:00
fi
# pip
if ! has_tags pm:pip3; then
yay_install python-pip
add_tag pm:pip3
fi
fi
# Debian/Ubuntu-ish
if has_tags pm:apt; then
sudo apt update
apt_install \
bsdtar \
tar \
gzip \
xz-utils \
python3-pip \
2018-02-17 19:12:09 +00:00
zsh \
zsh-syntax-highlighting \
jq \
2018-02-19 09:48:46 +00:00
git \
gnupg2
2018-02-17 19:12:09 +00:00
add_tag pm:pip3
fi
# Python3
if has_tags pm:pip3; then
pip3_install \
2019-11-22 09:22:54 +00:00
pipx
add_tag pm:pipx
fi
if has_tags pm:pipx; then
pipx_install \
powerline-status \
thefuck
2018-02-17 19:12:09 +00:00
fi
# change default terminal to urxvt
if has_tags desktop; then
if has_tags os_like:debian; then
sudo update-alternatives --config urxvt
fi
for de in gnome cinnamon; do
gsettings set org.${de}.desktop.default-applications.terminal exec /usr/bin/urxvt
gsettings set org.${de}.desktop.default-applications.terminal exec-arg "-x"
done
fi