xupdategit (898B)
1#!/bin/sh 2 3BASEDIR=$(realpath $(dirname $0)) 4XLOCATE_GIT="$(realpath $BASEDIR/xlocate.git)" 5XLOCATE_REPO="$(realpath $BASEDIR/../current)" 6 7xupdategit() { 8 set -e 9 DIR=$(mktemp -dt xlocate.XXXXXX) 10 DIR=$(/usr/bin/realpath -e "$DIR") 11 git init -q $DIR 12 cd $DIR 13 xbps-query -i --repository="$XLOCATE_REPO" -M -Ro '*' | awk ' 14 $0 ~ ": " { 15 s = index($0, ": ") 16 pkg = substr($0, 1, s-1) 17 file = substr($0, s+2) 18 sub(" *\\([^)]*\\)$", "", file) 19 print file >>pkg 20 }' 21 printf '%s\n' ./* | 22 LC_ALL= xargs -d'\n' -I'{}' -n1 -P "$(nproc)" -r -- \ 23 sort -o {} {} 24 git add ./* 25 git -c user.name=xupdategit -c user.email=xupdategit@none commit -q -m 'xupdategit' 26 git repack -ad 27 rm -rf "$XLOCATE_GIT" .git/COMMIT_EDITMSG .git/description \ 28 .git/index .git/hooks .git/logs 29 [ -n "${XLOCATE_GIT%/*}" ] && mkdir -p "${XLOCATE_GIT%/*}" 30 mv .git "$XLOCATE_GIT" 31 rm -rf "$DIR" 32} 33 34xupdategit