[provisioning] Add Arch Linux support

This commit is contained in:
Correl Roush 2021-02-04 19:05:51 -05:00
parent 961f8a856b
commit 4f3d284d6c
22 changed files with 180 additions and 28 deletions

View file

@ -110,6 +110,16 @@ function _recipe {
USER=${USER:-$(whoami)} USER=${USER:-$(whoami)}
_PLATFORM=$(uname -s | awk '{print tolower($1)}') _PLATFORM=$(uname -s | awk '{print tolower($1)}')
case $_PLATFORM in
linux)
if [ -f /etc/arch-release ]; then
_PLATFORM=arch
elif [ -f /etc/debian_version ]; then
_PLATFORM=debian
fi
;;
esac
if [ "${#INSTALL[@]}" -eq 0 ]; then if [ "${#INSTALL[@]}" -eq 0 ]; then
INSTALL=(base) INSTALL=(base)
fi fi

View file

@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
# Description: Debian Package Manager
set -e set -e
function _apt { function _apt {

29
recipes/_arch Normal file
View file

@ -0,0 +1,29 @@
#!/bin/bash
# Description: Arch Package Manager
set -e
function _pacman {
local pkg=$1
if ! pacman -Qi $pkg >/dev/null 2>&1; then
if [ -z "$__pacman_updated" ]; then
_run "[pacman] Synchronizing package databases" sudo pacman -Syy
__pacman_updated=yes
fi
_run "[pacman] Install $pkg" sudo pacman -S --noconfirm $pkg
else
echo "[pacman] $pkg is already installed, skipping."
fi
}
function _yay {
local pkg=$1
if ! yay -Qi $pkg >/dev/null 2>&1; then
if [ -z "$__yay_updated" ]; then
_run "[yay] Synchronizing package databases" yay -Syy
__pacman_updated=yes
fi
_run "[yay] Install $pkg" yay -S --noconfirm $pkg
else
echo "[yay] $pkg is already installed, skipping."
fi
}

View file

@ -29,13 +29,17 @@ function _brew_tap {
fi fi
} }
case "$(uname -s)" in case $_PLATFORM in
Darwin) darwin)
if ! which brew >/dev/null; then if ! which brew >/dev/null; then
_run "Install brew" /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" _run "Install brew" /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi fi
;; ;;
*) arch)
_recipe _arch
_yay brew-git
;;
debian)
_recipe _apt _recipe _apt
_recipe _path _recipe _path

View file

@ -25,6 +25,11 @@ case $_PLATFORM in
test -e /Applications/Google\ Chrome.app && _browserpass chrome test -e /Applications/Google\ Chrome.app && _browserpass chrome
test -e /Applications/Firefox.app && _browserpass firefox test -e /Applications/Firefox.app && _browserpass firefox
;; ;;
arch)
_recipe _arch
which chromium 2>&1 >/dev/null && _pacman browserpass-chromium
which firefox 2>&1 >/dev/null && _pacman browserpass-firefox
;;
*) *)
if ! test -d ~/.local/lib/browserpass; then if ! test -d ~/.local/lib/browserpass; then
echo "[curl] Downloading browserpass native" echo "[curl] Downloading browserpass native"

View file

@ -2,12 +2,16 @@
# Description: Terminal emulator mimicing old cathode tube screens # Description: Terminal emulator mimicing old cathode tube screens
set -e set -e
case "$(uname -s)" in case "$_PLATFORM" in
Darwin) darwin)
_recipe brew _recipe brew
_brew_cask cool-retro-term _brew_cask cool-retro-term
;; ;;
*) arch)
_recipe _arch
_pacman cool-retro-term
;;
debian)
_recipe _apt _recipe _apt
_ppa vantuz/cool-retro-term _ppa vantuz/cool-retro-term
_apt cool-retro-term _apt cool-retro-term

View file

@ -6,7 +6,11 @@ case $_PLATFORM in
darwin) darwin)
_brew elixir _brew elixir
;; ;;
*) arch)
_recipe _arch
_pacman elixir
;;
debian)
_recipe _apt _recipe _apt
_apt_source "deb https://packages.erlang-solutions.com/ubuntu $(lsb_release -cs) contrib" _apt_source "deb https://packages.erlang-solutions.com/ubuntu $(lsb_release -cs) contrib"

View file

@ -8,7 +8,11 @@ case $_PLATFORM in
_brew_tap railwaycat/emacsmacport _brew_tap railwaycat/emacsmacport
_brew emacs-mac --with-modern-icon _brew emacs-mac --with-modern-icon
;; ;;
linux) arch)
_recipe _arch
_pacman emacs
;;
debian)
_recipe _apt _recipe _apt
_ppa kelleyk/emacs _ppa kelleyk/emacs
_apt emacs27 _apt emacs27

View file

@ -91,7 +91,12 @@ case $_PLATFORM in
_brew isync _brew isync
EMACS=$(which emacs) _brew mu --HEAD EMACS=$(which emacs) _brew mu --HEAD
;; ;;
*) arch)
_recipe _arch
_pacman isync
_yay mu
;;
debian)
_recipe _apt _recipe _apt
for dep in \ for dep in \
build-essential \ build-essential \

View file

@ -10,7 +10,11 @@ case $_PLATFORM in
_recipe brew _recipe brew
_brew git _brew git
;; ;;
*) arch)
_recipe _arch
_pacman git
;;
debian)
_recipe _apt _recipe _apt
_ppa git-core/ppa _ppa git-core/ppa
_apt git _apt git

View file

@ -7,7 +7,11 @@ case $_PLATFORM in
_recipe brew _recipe brew
_brew gnuplot _brew gnuplot
;; ;;
*) arch)
_recipe _arch
_pacman gnuplot
;;
debian)
_recipe _apt _recipe _apt
_apt gnuplot _apt gnuplot
;; ;;

View file

@ -7,7 +7,11 @@ case $_PLATFORM in
_recipe brew _recipe brew
_brew graphviz _brew graphviz
;; ;;
*) arch)
_recipe _arch
_pacman graphviz
;;
debian)
_recipe _apt _recipe _apt
_apt graphviz _apt graphviz
;; ;;

View file

@ -7,7 +7,7 @@ case $_PLATFORM in
_recipe brew _recipe brew
_brew cmigemo _brew cmigemo
;; ;;
linux) debian)
_recipe _apt _recipe _apt
_apt kakasi _apt kakasi
_apt cmigemo _apt cmigemo

View file

@ -7,7 +7,11 @@ case $_PLATFORM in
_recipe brew _recipe brew
_brew ledger _brew ledger
;; ;;
*) arch)
_recipe _arch
_pacman ledger
;;
debian)
_recipe _apt _recipe _apt
_ppa mbudde/ledger _ppa mbudde/ledger
_apt ledger _apt ledger

View file

@ -9,7 +9,11 @@ case $_PLATFORM in
_brew_cask nextcloud _brew_cask nextcloud
_path /Applications/nextcloud.app/Contents/MacOS _path /Applications/nextcloud.app/Contents/MacOS
;; ;;
*) arch)
_recipe _arch
_pacman nextcloud-client
;;
debian)
_recipe _apt _recipe _apt
_ppa nextcloud-devs/client _ppa nextcloud-devs/client
_apt nextcloud-client _apt nextcloud-client

View file

@ -13,6 +13,10 @@ EOF
} }
case $_PLATFORM in case $_PLATFORM in
debian)
;&
arch)
;&
linux) linux)
_recipe _link _recipe _link
mkdir -p ~/.local/share/applications mkdir -p ~/.local/share/applications
@ -20,5 +24,5 @@ case $_PLATFORM in
${HOME}/.local/share/applications/org-protocol.desktop ${HOME}/.local/share/applications/org-protocol.desktop
_run "Install org-protocol handler" xdg-mime default org-protocol.desktop x-scheme-handler/org-protocol _run "Install org-protocol handler" xdg-mime default org-protocol.desktop x-scheme-handler/org-protocol
_run "Disable chrome external protocol dialog" __disable_chrome_external_protocol_dialog_linux _run "Disable chrome external protocol dialog" __disable_chrome_external_protocol_dialog_linux
;; ;;
esac esac

View file

@ -7,7 +7,11 @@ case $_PLATFORM in
_recipe brew _recipe brew
_brew pandoc _brew pandoc
;; ;;
*) arch)
_recipe _arch
_pacman pandoc
;;
debian)
if ! dpkg -s pandoc >/dev/null 2>&1; then if ! dpkg -s pandoc >/dev/null 2>&1; then
__pandoc_tmp="$(mktemp)" __pandoc_tmp="$(mktemp)"
_run "Download pandoc" curl -L -o "$__pandoc_tmp" "https://github.com/jgm/pandoc/releases/download/2.10/pandoc-2.10-1-amd64.deb" _run "Download pandoc" curl -L -o "$__pandoc_tmp" "https://github.com/jgm/pandoc/releases/download/2.10/pandoc-2.10-1-amd64.deb"

View file

@ -8,7 +8,12 @@ case $_PLATFORM in
_brew pass _brew pass
_brew pass-otp _brew pass-otp
;; ;;
*) arch)
_recipe _arch
_pacman pass
_pacman pass-otp
;;
debian)
_recipe _apt _recipe _apt
_apt pwgen _apt pwgen
_apt tree _apt tree

View file

@ -31,7 +31,12 @@ case $_PLATFORM in
_brew pyenv _brew pyenv
_brew pyenv-virtualenv _brew pyenv-virtualenv
;; ;;
*) arch)
_recipe _arch
_pacman pyenv
_yay pyenv-virtualenv
;;
debian)
_recipe _apt _recipe _apt
for dep in make build-essential libssl-dev zlib1g-dev libbz2-dev \ for dep in make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm \ libreadline-dev libsqlite3-dev wget curl llvm \

View file

@ -43,7 +43,28 @@ case $_PLATFORM in
_path $path \; _path $path \;
done done
;; ;;
*) arch)
_recipe _arch
# File browsing
_pacman tree
_pacman ncdu
# File compression
_pacman p7zip
# Misc
_pacman entr
_yay html-xml-utils
_pacman htop
_pacman jq
_yay lnav
_pacman ripgrep
_pacman the_silver_searcher
_pacman tig
_pacman tmux
;;
debian)
_recipe _apt _recipe _apt
# File browsing # File browsing

View file

@ -2,12 +2,35 @@
# Description: Document typesetting # Description: Document typesetting
set -e set -e
case "$(uname -s)" in __tex_init="tlmgr init-usertree 2>/dev/null || true"
Darwin) __tex_info="tlmgr --usermode info --only-installed"
__tex_install="tlmgr --usermode install"
case "$_PLATFORM" in
darwin)
_recipe brew _recipe brew
_brew_cask mactex _brew_cask mactex
;; ;;
*) arch)
_recipe _arch
_pacman texlive-bibtexextra
_pacman texlive-core
_pacman texlive-fontsextra
_pacman texlive-formatsextra
_pacman texlive-games
_pacman texlive-humanities
_pacman texlive-latexextra
_pacman texlive-music
_pacman texlive-pictures
_pacman texlive-pstricks
_pacman texlive-publishers
_pacman texlive-science
_yay tllocalmgr-git
__tex_init=""
__tex_info="tllocalmgr info --localsearch"
__tex_install="yes | tllocalmgr install"
;;
debian)
_recipe _apt _recipe _apt
# Install texlive if it isn't already available (e.g. a local or # Install texlive if it isn't already available (e.g. a local or
# portable installation). # portable installation).
@ -21,12 +44,12 @@ case "$(uname -s)" in
_apt xzdec _apt xzdec
esac esac
tlmgr init-usertree 2>/dev/null || true $__tex_init
function _tex { function _tex {
local pkg=$1 local pkg=$1
if ! tlmgr --usermode info --only-installed $pkg | grep -i '^installed:.*Yes$' >/dev/null 2>&1; then if ! $__tex_info $pkg | grep -i '^installed:.*Yes$' >/dev/null 2>&1; then
_run "[tex] Install $pkg" tlmgr --usermode install $@ _run "[tex] Install $pkg" bash -c "$__tex_install $@"
else else
echo "[tex] $pkg is already installed, skipping." echo "[tex] $pkg is already installed, skipping."
fi fi
@ -40,7 +63,7 @@ function _tex_git {
local install_path="$(kpsewhich -var-value TEXMFHOME)/tex/latex/${pkg}" local install_path="$(kpsewhich -var-value TEXMFHOME)/tex/latex/${pkg}"
if [[ ! -d "${install_path}" ]]; then if [[ ! -d "${install_path}" ]]; then
_git $2 "$(kpsewhich -var-value TEXMFHOME)/git/latex/${pkg}" _git $2 "$(kpsewhich -var-value TEXMFHOME)/git/latex/${pkg}"
_run "[tex] Install $pkg" ln -s "${clone_path}/${repo_path}" "${install_path}" _run "[tex] Install $pkg" mkdir -p "${install_path}" && ln -s "${clone_path}/${repo_path}" "${install_path}"
else else
echo "[tex] $pkg is already installed, skipping." echo "[tex] $pkg is already installed, skipping."
fi fi

View file

@ -7,7 +7,11 @@ case $_PLATFORM in
_recipe brew _recipe brew
_brew zsh _brew zsh
;; ;;
*) arch)
_recipe _arch
_pacman zsh
;;
debian)
_recipe _apt _recipe _apt
_apt zsh _apt zsh
;; ;;