about summary refs log tree commit diff
path: root/xlocate
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-06-02 15:51:01 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2016-06-02 15:51:01 +0200
commit742deda2875200a471f96822c2d0833fb4d5f752 (patch)
tree18d72d66f9483d424fa82d28654b43c809cfb223 /xlocate
parent33b3ebf5fa44c5e9edaaef1e15fe7618f1973a3b (diff)
downloadxtools-742deda2875200a471f96822c2d0833fb4d5f752.tar.gz
xtools-742deda2875200a471f96822c2d0833fb4d5f752.tar.xz
xtools-742deda2875200a471f96822c2d0833fb4d5f752.zip
xlocate: add remote search-repo support v0.41
Diffstat (limited to 'xlocate')
-rwxr-xr-xxlocate14
1 files changed, 13 insertions, 1 deletions
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