diff --git a/bootstrap-Linux-rootless.sh b/bootstrap-Linux-rootless.sh new file mode 100755 index 0000000..7cf7500 --- /dev/null +++ b/bootstrap-Linux-rootless.sh @@ -0,0 +1,91 @@ +#!/usr/bin/env bash + +error() { + echo "$1 not found" >&2 + exit 1 +} + +download() { + local url=$1 + local output=$2 + if command -v curl &> /dev/null; then + curl -o $output --location $url + elif command -v wget &> /dev/null; then + wget -O $output $url + else + error "curl/wget not found" + fi +} + +download https://git.infektor.net/config/local/raw/branch/main/roles/bash/templates/bashrc ~/.bashrc +download https://git.infektor.net/config/local/raw/branch/main/roles/readline/templates/inputrc ~/.inputrc + +if ! command -v git &> /dev/null; then + error "git not found" +fi + +git-clone-or-pull() { + local repo=$1 + local dir=$2 + if [ -d $dir ]; then + git -C $dir pull + else + git clone $repo $dir + fi +} + +git-clone-or-pull https://git.infektor.net/config/nvim.git ~/.config/nvim +# TODO: install nvim + +git-clone-or-pull https://git.infektor.net/config/zsh.git ~/.config/zsh +# TODO: build & install zsh +if command -v zsh &> /dev/null; then + zsh ~/.config/zsh/install.zsh +fi + +git-clone-or-pull https://git.infektor.net/config/tmux.git ~/.config/tmux +~/.config/tmux/install.sh + +mkdir -p ~/.local/bin +mkdir -p ~/.local/share/man/man1 +mkdir -p ~/.local/share/zsh/site-functions + +if ! command -v rg &> /dev/null; then + mkdir -p ~/.cache/tmp + pushd ~/.cache/tmp + + download https://github.com/BurntSushi/ripgrep/releases/download/14.1.1/ripgrep-14.1.1-i686-unknown-linux-gnu.tar.gz rg.tar.gz + tar zxf rg.tar.gz --strip-components=1 --no-same-owner + mv rg ~/.local/bin + mv doc/rg.1 ~/.local/share/man/man1/rg.1 + mv complete/_rg ~/.local/share/zsh/site-functions + + popd + rm -r ~/.cache/tmp +fi + +if ! command -v fzf &> /dev/null; then + mkdir -p ~/.cache/tmp + pushd ~/.cache/tmp + + download https://github.com/junegunn/fzf/releases/download/v0.64.0/fzf-0.64.0-linux_amd64.tar.gz fzf.tar.gz + tar zxf fzf.tar.gz + mv fzf ~/.local/bin + + popd + rm -r ~/.cache/tmp +fi + +if ! command -v bat &> /dev/null; then + mkdir -p ~/.cache/tmp + pushd ~/.cache/tmp + + download https://github.com/sharkdp/bat/releases/download/v0.25.0/bat-v0.25.0-x86_64-unknown-linux-musl.tar.gz bat.tar.gz + tar zxf bat.tar.gz --strip-components=1 --no-same-owner + mv bat ~/.local/bin + mv bat.1 ~/.local/share/man/man1 + mv autocomplete/bat.zsh ~/.local/share/zsh/site-functions/_bat + + popd + rm -r ~/.cache/tmp +fi