#!/bin/sh -e . ./os.sh apt_install() { DEBIAN_FRONTEND="noninteractive" sudo apt-get install -y "$@" } 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 } pacaur_install() { pacaur -S --noconfirm --needed "$@" } yaourt_install() { yaourt -S --noconfirm --needed "$@" } pip3_install() { pip3 install --ignore-installed --user -U "$@" } pipx_install() { for pkg in "$@" do pipx install --force "$pkg" done } download() { curl -L "$@" } ### # Actual package installation code from here # macOS brew if has_tags pm:brew; then brew update brew install \ coreutils \ libarchive \ gnu-tar \ gzip \ xz \ jq \ git \ gnupg \ md5sha1sum \ rxvt-unicode \ zsh \ zsh-syntax-highlighting fi # Arch Linux if has_tags pm:pacman; then # libarchive for bsdtar sudo pacman -Sy pacman_install \ base-devel \ libarchive \ tar \ gzip \ xz \ jq \ git \ gnupg # 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 makepkg -sri --noconfirm cd rm -rf "${dir}" ) fi add_tag pm:yay fi # from here on we should have yay available yay_install \ zsh \ zsh-syntax-highlighting \ logo-ls if has_tags desktop; then yay_install \ powerline-fonts \ ttf-nerd-fonts-symbols \ ttf-fira-code 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 \ zsh \ zsh-syntax-highlighting \ jq \ git \ gnupg2 add_tag pm:pip3 fi # Python3 if has_tags pm:pip3; then pip3_install \ pipx add_tag pm:pipx fi if has_tags pm:pipx; then pipx_install \ powerline-status \ thefuck 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