From 5fd4472c50ab1f67b5328d68dd186f25f58f9996 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Tue, 10 Oct 2017 14:09:32 +0200 Subject: [PATCH] add fetch-3rd-party.sh and remove installExternal.sh The new script not only clones the git repo once but can also pulls updates from all git repositories every time it is executed and allows to symlink binaries into $HOME/bin --- fetch-3rd-party.sh | 37 +++++++++++++++++++++++++++++++++++++ installExternal.sh | 5 ----- 2 files changed, 37 insertions(+), 5 deletions(-) create mode 100755 fetch-3rd-party.sh delete mode 100755 installExternal.sh diff --git a/fetch-3rd-party.sh b/fetch-3rd-party.sh new file mode 100755 index 0000000..e0a6b40 --- /dev/null +++ b/fetch-3rd-party.sh @@ -0,0 +1,37 @@ +#!/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 barpyrus https://github.com/t-wissmann/barpyrus.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"' diff --git a/installExternal.sh b/installExternal.sh deleted file mode 100755 index c0c7a70..0000000 --- a/installExternal.sh +++ /dev/null @@ -1,5 +0,0 @@ -#! /bin/bash -mkdir ~/misc -cd ~/misc - -git clone https://github.com/t-wissmann/barpyrus.git