mirror of
https://github.com/correl/dotfiles.git
synced 2024-11-27 03:00:06 +00:00
[provisioning] Add Arch Linux support
This commit is contained in:
parent
961f8a856b
commit
4f3d284d6c
22 changed files with 180 additions and 28 deletions
10
provision.sh
10
provision.sh
|
@ -110,6 +110,16 @@ function _recipe {
|
|||
USER=${USER:-$(whoami)}
|
||||
_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
|
||||
INSTALL=(base)
|
||||
fi
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/bin/bash
|
||||
# Description: Debian Package Manager
|
||||
set -e
|
||||
|
||||
function _apt {
|
||||
|
|
29
recipes/_arch
Normal file
29
recipes/_arch
Normal 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
|
||||
}
|
10
recipes/brew
10
recipes/brew
|
@ -29,13 +29,17 @@ function _brew_tap {
|
|||
fi
|
||||
}
|
||||
|
||||
case "$(uname -s)" in
|
||||
Darwin)
|
||||
case $_PLATFORM in
|
||||
darwin)
|
||||
if ! which brew >/dev/null; then
|
||||
_run "Install brew" /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
arch)
|
||||
_recipe _arch
|
||||
_yay brew-git
|
||||
;;
|
||||
debian)
|
||||
_recipe _apt
|
||||
_recipe _path
|
||||
|
||||
|
|
|
@ -25,6 +25,11 @@ case $_PLATFORM in
|
|||
test -e /Applications/Google\ Chrome.app && _browserpass chrome
|
||||
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
|
||||
echo "[curl] Downloading browserpass native"
|
||||
|
|
|
@ -2,12 +2,16 @@
|
|||
# Description: Terminal emulator mimicing old cathode tube screens
|
||||
set -e
|
||||
|
||||
case "$(uname -s)" in
|
||||
Darwin)
|
||||
case "$_PLATFORM" in
|
||||
darwin)
|
||||
_recipe brew
|
||||
_brew_cask cool-retro-term
|
||||
;;
|
||||
*)
|
||||
arch)
|
||||
_recipe _arch
|
||||
_pacman cool-retro-term
|
||||
;;
|
||||
debian)
|
||||
_recipe _apt
|
||||
_ppa vantuz/cool-retro-term
|
||||
_apt cool-retro-term
|
||||
|
|
|
@ -6,7 +6,11 @@ case $_PLATFORM in
|
|||
darwin)
|
||||
_brew elixir
|
||||
;;
|
||||
*)
|
||||
arch)
|
||||
_recipe _arch
|
||||
_pacman elixir
|
||||
;;
|
||||
debian)
|
||||
_recipe _apt
|
||||
|
||||
_apt_source "deb https://packages.erlang-solutions.com/ubuntu $(lsb_release -cs) contrib"
|
||||
|
|
|
@ -8,7 +8,11 @@ case $_PLATFORM in
|
|||
_brew_tap railwaycat/emacsmacport
|
||||
_brew emacs-mac --with-modern-icon
|
||||
;;
|
||||
linux)
|
||||
arch)
|
||||
_recipe _arch
|
||||
_pacman emacs
|
||||
;;
|
||||
debian)
|
||||
_recipe _apt
|
||||
_ppa kelleyk/emacs
|
||||
_apt emacs27
|
||||
|
|
|
@ -91,7 +91,12 @@ case $_PLATFORM in
|
|||
_brew isync
|
||||
EMACS=$(which emacs) _brew mu --HEAD
|
||||
;;
|
||||
*)
|
||||
arch)
|
||||
_recipe _arch
|
||||
_pacman isync
|
||||
_yay mu
|
||||
;;
|
||||
debian)
|
||||
_recipe _apt
|
||||
for dep in \
|
||||
build-essential \
|
||||
|
|
|
@ -10,7 +10,11 @@ case $_PLATFORM in
|
|||
_recipe brew
|
||||
_brew git
|
||||
;;
|
||||
*)
|
||||
arch)
|
||||
_recipe _arch
|
||||
_pacman git
|
||||
;;
|
||||
debian)
|
||||
_recipe _apt
|
||||
_ppa git-core/ppa
|
||||
_apt git
|
||||
|
|
|
@ -7,7 +7,11 @@ case $_PLATFORM in
|
|||
_recipe brew
|
||||
_brew gnuplot
|
||||
;;
|
||||
*)
|
||||
arch)
|
||||
_recipe _arch
|
||||
_pacman gnuplot
|
||||
;;
|
||||
debian)
|
||||
_recipe _apt
|
||||
_apt gnuplot
|
||||
;;
|
||||
|
|
|
@ -7,7 +7,11 @@ case $_PLATFORM in
|
|||
_recipe brew
|
||||
_brew graphviz
|
||||
;;
|
||||
*)
|
||||
arch)
|
||||
_recipe _arch
|
||||
_pacman graphviz
|
||||
;;
|
||||
debian)
|
||||
_recipe _apt
|
||||
_apt graphviz
|
||||
;;
|
||||
|
|
|
@ -7,7 +7,7 @@ case $_PLATFORM in
|
|||
_recipe brew
|
||||
_brew cmigemo
|
||||
;;
|
||||
linux)
|
||||
debian)
|
||||
_recipe _apt
|
||||
_apt kakasi
|
||||
_apt cmigemo
|
||||
|
|
|
@ -7,7 +7,11 @@ case $_PLATFORM in
|
|||
_recipe brew
|
||||
_brew ledger
|
||||
;;
|
||||
*)
|
||||
arch)
|
||||
_recipe _arch
|
||||
_pacman ledger
|
||||
;;
|
||||
debian)
|
||||
_recipe _apt
|
||||
_ppa mbudde/ledger
|
||||
_apt ledger
|
||||
|
|
|
@ -9,7 +9,11 @@ case $_PLATFORM in
|
|||
_brew_cask nextcloud
|
||||
_path /Applications/nextcloud.app/Contents/MacOS
|
||||
;;
|
||||
*)
|
||||
arch)
|
||||
_recipe _arch
|
||||
_pacman nextcloud-client
|
||||
;;
|
||||
debian)
|
||||
_recipe _apt
|
||||
_ppa nextcloud-devs/client
|
||||
_apt nextcloud-client
|
||||
|
|
|
@ -13,6 +13,10 @@ EOF
|
|||
}
|
||||
|
||||
case $_PLATFORM in
|
||||
debian)
|
||||
;&
|
||||
arch)
|
||||
;&
|
||||
linux)
|
||||
_recipe _link
|
||||
mkdir -p ~/.local/share/applications
|
||||
|
@ -20,5 +24,5 @@ case $_PLATFORM in
|
|||
${HOME}/.local/share/applications/org-protocol.desktop
|
||||
_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
|
||||
;;
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -7,7 +7,11 @@ case $_PLATFORM in
|
|||
_recipe brew
|
||||
_brew pandoc
|
||||
;;
|
||||
*)
|
||||
arch)
|
||||
_recipe _arch
|
||||
_pacman pandoc
|
||||
;;
|
||||
debian)
|
||||
if ! dpkg -s pandoc >/dev/null 2>&1; then
|
||||
__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"
|
||||
|
|
|
@ -8,7 +8,12 @@ case $_PLATFORM in
|
|||
_brew pass
|
||||
_brew pass-otp
|
||||
;;
|
||||
*)
|
||||
arch)
|
||||
_recipe _arch
|
||||
_pacman pass
|
||||
_pacman pass-otp
|
||||
;;
|
||||
debian)
|
||||
_recipe _apt
|
||||
_apt pwgen
|
||||
_apt tree
|
||||
|
|
|
@ -31,7 +31,12 @@ case $_PLATFORM in
|
|||
_brew pyenv
|
||||
_brew pyenv-virtualenv
|
||||
;;
|
||||
*)
|
||||
arch)
|
||||
_recipe _arch
|
||||
_pacman pyenv
|
||||
_yay pyenv-virtualenv
|
||||
;;
|
||||
debian)
|
||||
_recipe _apt
|
||||
for dep in make build-essential libssl-dev zlib1g-dev libbz2-dev \
|
||||
libreadline-dev libsqlite3-dev wget curl llvm \
|
||||
|
|
|
@ -43,7 +43,28 @@ case $_PLATFORM in
|
|||
_path $path \;
|
||||
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
|
||||
|
||||
# File browsing
|
||||
|
|
37
recipes/tex
37
recipes/tex
|
@ -2,12 +2,35 @@
|
|||
# Description: Document typesetting
|
||||
set -e
|
||||
|
||||
case "$(uname -s)" in
|
||||
Darwin)
|
||||
__tex_init="tlmgr init-usertree 2>/dev/null || true"
|
||||
__tex_info="tlmgr --usermode info --only-installed"
|
||||
__tex_install="tlmgr --usermode install"
|
||||
|
||||
case "$_PLATFORM" in
|
||||
darwin)
|
||||
_recipe brew
|
||||
_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
|
||||
# Install texlive if it isn't already available (e.g. a local or
|
||||
# portable installation).
|
||||
|
@ -21,12 +44,12 @@ case "$(uname -s)" in
|
|||
_apt xzdec
|
||||
esac
|
||||
|
||||
tlmgr init-usertree 2>/dev/null || true
|
||||
$__tex_init
|
||||
|
||||
function _tex {
|
||||
local pkg=$1
|
||||
if ! tlmgr --usermode info --only-installed $pkg | grep -i '^installed:.*Yes$' >/dev/null 2>&1; then
|
||||
_run "[tex] Install $pkg" tlmgr --usermode install $@
|
||||
if ! $__tex_info $pkg | grep -i '^installed:.*Yes$' >/dev/null 2>&1; then
|
||||
_run "[tex] Install $pkg" bash -c "$__tex_install $@"
|
||||
else
|
||||
echo "[tex] $pkg is already installed, skipping."
|
||||
fi
|
||||
|
@ -40,7 +63,7 @@ function _tex_git {
|
|||
local install_path="$(kpsewhich -var-value TEXMFHOME)/tex/latex/${pkg}"
|
||||
if [[ ! -d "${install_path}" ]]; then
|
||||
_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
|
||||
echo "[tex] $pkg is already installed, skipping."
|
||||
fi
|
||||
|
|
|
@ -7,7 +7,11 @@ case $_PLATFORM in
|
|||
_recipe brew
|
||||
_brew zsh
|
||||
;;
|
||||
*)
|
||||
arch)
|
||||
_recipe _arch
|
||||
_pacman zsh
|
||||
;;
|
||||
debian)
|
||||
_recipe _apt
|
||||
_apt zsh
|
||||
;;
|
||||
|
|
Loading…
Reference in a new issue