summary refs log tree commit diff
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
parent33b3ebf5fa44c5e9edaaef1e15fe7618f1973a3b (diff)
downloadxtools-742deda2875200a471f96822c2d0833fb4d5f752.tar.gz
xtools-742deda2875200a471f96822c2d0833fb4d5f752.tar.xz
xtools-742deda2875200a471f96822c2d0833fb4d5f752.zip
xlocate: add remote search-repo support v0.41
-rw-r--r--README2
-rwxr-xr-xxlocate14
2 files changed, 14 insertions, 2 deletions
diff --git a/README b/README
index 15a4cd3..ee64b87 100644
--- a/README
+++ b/README
@@ -21,7 +21,7 @@ https://github.com/voidlinux/xbps
   xilog [PATTERN] - list installed packages by install-date
   xlg PKG - open short commit log for XBPS template
   xlint TEMPLATE - scan XBPS template for common mistakes
-  xlocate [-u | -g | PATTERN] - locate files in all XBPS packages
+  xlocate [-u | -g | -S | PATTERN] - locate files in all XBPS packages
   xlog PKG - open commit log for XBPS template
   xls PKGS... - list files contained in PKGS (including binpkgs)
   xmandoc MANPAGE - read manpage of possibly not installed package
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