#!/bin/bash -e ::() { echo ":: $*" >&2 "$@" } # usage: fetch [ ...] fetch() { dir="$HOME/misc/$1" if [ -d "$dir" ]; then # try to pull changes from repository without merging :: git --git-dir="$dir/.git" --work-tree="$dir" pull --ff-only else # clone repository if it does not exist yet :: git clone "$2" "$dir" fi shift shift # symlink all following filenames into $HOME/bin if existent while x="$1"; shift; do file=$(:: find "$dir" -name "$x" | head -n 1) if [ -z "$file" ]; then echo "Missing file: $x" else target="${file##*/}" target="${target%.py}" :: ln -sf "$file" "$HOME/bin/$target" fi done } fetch urxvt-font-size https://github.com/majutsushi/urxvt-font-size :: mkdir -p $HOME/.urxvt/ext && ln -sf $HOME/misc/urxvt-font-size/font-size $HOME/.urxvt/ext/ fetch barpyrus https://github.com/t-wissmann/barpyrus.git fetch wallpapers https://git.tpreisner.de/preisi/wallpapers.git fetch i3lock-fancy https://github.com/meskarune/i3lock-fancy.git lock fetch siji https://github.com/stark/siji :: sh -c 'cd $HOME/misc/siji && ./install.sh -d "$HOME/.fonts"'