Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
emerge list from file
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
TimSSC
Apprentice
Apprentice


Joined: 20 Apr 2006
Posts: 170
Location: Cambridge, MA

PostPosted: Sat Jul 29, 2006 7:03 am    Post subject: emerge list from file Reply with quote

I am installing the same gentoo system on several machines, and to make the process easier, I wanted to make a file, where eachline is a package to emerge. Therefor, if I wanted to add a package, I would just add it to the list, and emerge the list with the --no-replace option, and if I wanted to install a new system, the package owuld already be there.

The problem is I can't figure out how to feed a file into emerge. Is there a simple scripting way to do this? Or a better way to provide the functions I'm looking for?

thanks.
Back to top
View user's profile Send private message
intmain
Apprentice
Apprentice


Joined: 14 Dec 2005
Posts: 179
Location: Austria

PostPosted: Sat Jul 29, 2006 8:16 am    Post subject: Reply with quote

If you have a file where each line contains a package name, e.g. packages.list, then you can emerge these packages with
Code:
cat < emerge.list | xargs emerge
Back to top
View user's profile Send private message
TimSSC
Apprentice
Apprentice


Joined: 20 Apr 2006
Posts: 170
Location: Cambridge, MA

PostPosted: Sat Jul 29, 2006 5:10 pm    Post subject: Reply with quote

thanks, that's just what I was looking for. One question though, what is the difference between
Code:
cat < emerge.list | xargs emerge


and

Code:
cat emerge.list | xargs emerge
Back to top
View user's profile Send private message
intmain
Apprentice
Apprentice


Joined: 14 Dec 2005
Posts: 179
Location: Austria

PostPosted: Sun Jul 30, 2006 7:35 am    Post subject: Reply with quote

In this case there is no difference, you can also write cat emerge.list | xargs emerge (which is of course the shorter form) because cat can read it's input directly from a file. If cat couldn't read it's input directly from a file you would need the <.
Back to top
View user's profile Send private message
Genone
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 9527
Location: beyond the rim

PostPosted: Sun Jul 30, 2006 12:53 pm    Post subject: Reply with quote

Or a bit simpler:
Code:
emerge $(< emerge.list)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum