From 742deda2875200a471f96822c2d0833fb4d5f752 Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Thu, 2 Jun 2016 15:51:01 +0200 Subject: xlocate: add remote search-repo support --- xlocate | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'xlocate') diff --git a/xlocate b/xlocate index 255ca8f..cbfbfe4 100755 --- a/xlocate +++ b/xlocate @@ -1,8 +1,9 @@ #!/bin/sh -# xlocate [-u | -g | PATTERN] - locate files in all XBPS packages +# xlocate [-u | -g | -S | PATTERN] - locate files in all XBPS packages : ${XLOCATE_DB:=~/.cache/xlocate.db} : ${XLOCATE_GIT:=~/.cache/xlocate.git} +: ${XLOCATE_REPO:=https://repo.voidlinux.eu/xlocate/xlocate.git} if command -v pv >/dev/null; then PROGRESS="pv -l" @@ -45,12 +46,23 @@ xupdategit() { rm -rf "$DIR" } +xsyncgit() { + if [ -d "$XLOCATE_GIT" ]; then + git -C "$XLOCATE_GIT" fetch -u -f "$XLOCATE_REPO" master:master + else + git clone --bare "$XLOCATE_REPO" "$XLOCATE_GIT" + fi +} + if [ "$1" = -u ]; then xupdatedb exit $? elif [ "$1" = -g ]; then xupdategit exit $? +elif [ "$1" = -S ]; then + xsyncgit + exit $? fi if [ -d "$XLOCATE_GIT" ]; then -- cgit 1.4.1