about summary refs log tree commit diff
path: root/xlocate
diff options
context:
space:
mode:
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