From 223654f0fac8feafe3d2209ad4e39760672f3648 Mon Sep 17 00:00:00 2001 From: Steven Penny Date: Sun, 16 Mar 2014 23:59:24 -0500 Subject: [PATCH] searchall command This is similar to the "apt-file search" command, and almost identical to the "cygcheck --package-query" command. Instead of only search for a file from installed packages, it searches all available packages. I have included it as a separate command because it "wget"s cygwin.com and can be slow at times. --- apt-cyg | 53 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/apt-cyg b/apt-cyg index 63f7cba..0148841 100755 --- a/apt-cyg +++ b/apt-cyg @@ -36,24 +36,25 @@ fi function usage () { rw=( - 'usage: apt-cyg [command] [options] [packages]' - '' - 'Commands:' - ' install install packages' - ' remove remove packages' - ' update update setup.ini' - ' list [patterns] list packages matching given pattern. If no' - ' pattern is given, list all installed packages.' - ' show show packages matching patterns' - ' search search for a filename from installed packages' - '' - 'Options:' - ' -c, --cache set cache' - ' -f, --file read package names from file' - ' -m, --mirror set mirror' - ' -u, --noupdate don’t update setup.ini from mirror' - ' --help' - ' --version' + 'usage: apt-cyg [command] [options] [packages]' + '' + 'Commands:' + ' install install packages' + ' remove remove packages' + ' update update setup.ini' + ' list [patterns] list packages matching given pattern. If no' + ' pattern is given, list all installed packages.' + ' show show packages matching patterns' + ' search search for a filename from installed packages' + ' searchall search for a filename from all available packages' + '' + 'Options:' + ' -c, --cache set cache' + ' -f, --file read package names from file' + ' -m, --mirror set mirror' + ' -u, --noupdate don’t update setup.ini from mirror' + ' --help' + ' --version' ) printf '%s\n' "${rw[@]}" } @@ -178,7 +179,7 @@ do shift ;; - update | list | show | search | install | remove) + update | list | show | search | searchall | install | remove) if (( ${#command} )) then packages+=" $1" @@ -267,6 +268,20 @@ case "$command" in done ;; + searchall) + for pkg in $packages + do + printf -v qs 'text=1&arch=%s&grep=%s' $ARCH "$pkg" + cd /tmp + wget -O matches cygwin.com/cgi-bin2/package-grep.cgi?"$qs" + awk ' + ! /-src\t$/ && + ! mc[$2]++ && + $0=$2 + ' FS=/ matches + done + ;; + install) checkpackages findworkspace