From: Richard Kettlewell Sent: 11 January 2006 12:53
Steve Engledow sengledow@formrecognition.com writes:
Here's one for the debian aficionados on the list, is it possible
to
use apt-get install with a list of packages fed in from a file?
cat filename | xargs sudo apt-get install
xargs sudo apt-get install < filename
Yes, I forgot about xargs. A nice little utility, especially when used with something like find.
However I went with the $(cat filename) option as it seemed IMO a little more elegant to use the shell's built in features rather than a separate program (but that's just a personal bit of lunacy :-) )
In case you're interested, what I'm doing is setting up a new box. I started off just upgrading from a 20Gb to an 80Gb HD (friend was upgrading from 80Gb to 200Gb so I got it cheap) and then decided to get a DVD-RW drive for backing up the new drive and then a colleague at work had a system unit minus HD and DVD/CD going spare (faster CPU, better graphics, more memory, etc, etc) so I ended up with a completely "new" system unit.
I had 2 issues;
1) cloning my WinXP home set up to the new disk
2) duplicating my Ubuntu set-up on the new system
Didn't want the hassle of a complete new WinXP install (plus all the cruft accumulated over the years) so tried copying the partition using Partition Manager, partimage and a couple of others whose name escapes me but the windows protection kept getting in the way. Finally found a nice little utility called HDClone http://www.miray.de/products/sat.hdclone.html#free. It's proprietary but free for personal use. Worked a treat.
Was very impressed by the development that has occurred to partimage since I last looked, if you're interested it's worth also looking at the SystemRescueCd http://www.sysresccd.org/, I found it invaluable when I was backing up bits of my original disk and moving things around.
For various reasons, I wanted to do a fresh install of Ubuntu (5.10) and then add all the extra packages I'd installed since. Getting a list of my currently installed packages was easy using apt-showversions (yes I know about dpkg-query but apt-showversions' output was easier to edit) and editing the resulting output into a list of installed packages.
A complete new ubuntu install takes just minutes, so, hopefully, using apt-get and the list of packages I should be more or less back to where I was but with better kit. Hence the original question.
Regards,
Keith ____________ ABSURDITY, n. - A statement or belief manifestly inconsistent with one's own opinion. - Ambrose Bierce - The Devil's Dictionary
"Keith Watson" keith.watson@kewill.com
However I went with the $(cat filename) option as it seemed IMO a little more elegant to use the shell's built in features rather than a separate program (but that's just a personal bit of lunacy :-) )
Try $(< filename) and use the shell's built-in features to avoid the gratuitous use of cat, as mentioned in man bash. You'll need xargs if you have too many things for one command line, I think.
Can anyone cut it down more? ;-)
Regards,
On Wed, Jan 11, 2006 at 01:45:38PM +0000, MJ Ray wrote:
"Keith Watson" keith.watson@kewill.com
However I went with the $(cat filename) option as it seemed IMO a little more elegant to use the shell's built in features rather than a separate program (but that's just a personal bit of lunacy :-) )
Try $(< filename) and use the shell's built-in features to avoid the gratuitous use of cat, as mentioned in man bash. You'll need xargs if you have too many things for one command line, I think.
That also works for multiline files... changing them in to space seperated args like a nice little shell.
$ cat test blip blat blop $ echo $(<test) blip blat blop $
I'd still go the xargs route though :)
Cheers,