add locate function

This commit is contained in:
emmett1
2020-04-07 00:39:12 +08:00
parent c816e3b409
commit 3602e0a8e8
2 changed files with 21 additions and 0 deletions

13
pkglocate Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/sh
REPO_FILE="/etc/scratchpkg.repo"
if [ -f "$REPO_FILE" ]; then
for repodir in $(grep -Ev '^(#|$)' "$REPO_FILE" | awk '{print $1}'); do
PORT_REPO="$PORT_REPO $repodir"
done
fi
for repo in $PORT_REPO; do
grep -R $@ $repo/*/.pkgfiles | sed 's/:/ /;s/\/\.pkgfiles//' | awk '{print $1,$4}' | column -t
done

View File

@@ -206,6 +206,13 @@ scratch_lock() {
done
}
scratch_locate() {
needarg $@
for repo in $PORT_REPO; do
grep -R $@ $repo/*/.pkgfiles | sed 's/:/ /;s/\/\.pkgfiles//' | awk '{print $1,$4}' | column -t
done
}
scratch_unlock() {
needroot "Unlocking package"
for pkg in "$@"; do
@@ -1357,6 +1364,7 @@ Options:
readme <port> print readme file, if exist
files <port> print files installed
info <port> print information
locate <files> print location of files in ports repo
sync update ports database
outdate print outdated ports
cache print and clear old pkg and src caches