search and install packages via bash?

Richard Beels spiffnetservice@gmail.com
Sat Jul 10 04:14:37 GMT 2021


At 07/08/2021 at 17:11, Shakespearean monkeys danced on Richard Beels 
via Cygwin's keyboard and said:

><snipped>
>2, use fzf.  i don't use it (yet?) but it should be something like:


I decided to download fzf and play with this since the itch grabbed 
me...  It took all of 5 seconds for me to remember a bunch of 
packages with a "-" in the name, so came up with this instead:

cyginst() { # install cygwin package(s) from the commandline, can't do *-src
_pkg=$(cygcheck -p "$1"       \
     | grep "$1"               \
     | fzf --multi --reverse   \
     | sed -E 's_-[0-9]+.*$__' \
     | tr '\n' ','             \
     | sed 's_,$__')
/setup-x86_64.exe --packages "$_pkg"
}

Since this would whack -src, I tried to figure out how to install 
just a source package from the commandline to see if this would 
matter but couldn't figure it out, so I guess the -I option is there 
for a reason.

But I came across a weirdity with setup (2.908).  While you can 
change the mode into download (-D) only or local-install (-L) via 
commandline, I couldn't figure out how to change it back to "install 
from the internet" from the commandline.  I think there should be a 
parameter for this, but heck if I I have any idea about C++ (I can 
barely spell it).

At a minimum, it seems that the code currently is in contradiction to 
the --help output: once you choose -L or -D, that becomes the default 
mode for subsequent runs.  Until explicitly changed back by running 
setup and clicking the appropriate button on the second dialog.  It 
looks like the "last-action" setting in /etc/setup/setup.rc controls 
what is used as the default: "Download", "Install" (local install) 
and "Download, Install" (internet install).  The expected behavior 
would be as the --help output describes.




Cheers!



More information about the Cygwin mailing list