View previous topic :: View next topic |
Author |
Message |
CptClyde n00b

Joined: 18 Jan 2023 Posts: 18
|
Posted: Thu Apr 27, 2023 12:41 pm Post subject: [SOLVED] merge a list of packages? |
|
|
Is there a way to pipe into emerge a list of packages to install?
I do not see any options built into the emerge in the man page and the following do not seem to work:
Code: | cat list | xargs emerge -a |
Is there something I'm missing? I thought assumed this would be trivial but is apparently beyond me.
Last edited by CptClyde on Thu Apr 27, 2023 12:59 pm; edited 1 time in total |
|
Back to top |
|
 |
grknight Retired Dev

Joined: 20 Feb 2015 Posts: 2262
|
Posted: Thu Apr 27, 2023 12:54 pm Post subject: Re: merge a list of packages? |
|
|
CptClyde wrote: | Code: | cat list | xargs emerge -a |
|
Works for me. So does emerge -a $(cat list)
This assumes what is in "list" are valid atoms.
See also user defined sets on the wiki and man pages |
|
Back to top |
|
 |
CptClyde n00b

Joined: 18 Jan 2023 Posts: 18
|
Posted: Thu Apr 27, 2023 12:59 pm Post subject: [solved] |
|
|
Interesting, this is what I see when I try the 'xargs' command:
Code: | gentoo ~ # cat flatlist | xargs emerge -a
!!! "--ask" should only be used in a terminal. Exiting. |
but your emerge -a $(cat list) does seem to work for me. Thanks a ton.
.... yes a few of the atoms are ambiguous and require full names be added it seems.
Thanks for the help. |
|
Back to top |
|
 |
Hu Administrator

Joined: 06 Mar 2007 Posts: 23670
|
Posted: Thu Apr 27, 2023 3:14 pm Post subject: Re: [SOLVED] merge a list of packages? |
|
|
CptClyde wrote: | Is there a way to pipe into emerge a list of packages to install? | You must list them all on the command line, or in a set that is referenced on the command line. However, the command line length limit is quite generous, and there is no need to type them all on the command line. Any command that ultimately runs emerge with the right arguments will suffice. xargs is the most obvious approach, though it has a potentially undesirable quirk if your argument list is exceedingly long, since it would run more than one emerge.This would emerge nothing, and if emerge did not exit due to that, it would ask the listfile if you want to proceed with merging nothing. CptClyde wrote: | Code: | cat list | xargs emerge -a |
| This is a Useless Use Of Cat. Use xargs emerge -a <list to get the same effect more cleanly. CptClyde wrote: | Interesting, this is what I see when I try the 'xargs' command: Code: | gentoo ~ # cat flatlist | xargs emerge -a
!!! "--ask" should only be used in a terminal. Exiting. |
| Right. Per info xargs, the child process (emerge) will be run with stdin redirected from null, which is not a terminal. You could choose not to use --ask here, or you could use the xargs option --arg-file to preserve stdin. CptClyde wrote: | but your emerge -a $(cat list) does seem to work for me. | In bash, this can be simplified as emerge -a $(< list) to avoid the cat call. |
|
Back to top |
|
 |
|