You are not logged in.

#1 2010-10-19 23:39:35

DarksideEE7
Member
From: Arkansas, United States
Registered: 2009-06-06
Posts: 356

[SOLVED] Getting pacman to use a text file as input

I would like to know if there is a way to make pacman use a text file as it's input to install a long list of packages.  The list I have was generated using:

sudo pacman -Q > pacman.out

I tried

sudo pacman -S < pacman.out

Is this possible?  Thanks

Last edited by DarksideEE7 (2010-10-20 01:41:39)

Offline

#2 2010-10-19 23:46:31

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] Getting pacman to use a text file as input


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2010-10-19 23:49:11

DarksideEE7
Member
From: Arkansas, United States
Registered: 2009-06-06
Posts: 356

Re: [SOLVED] Getting pacman to use a text file as input

Awesome, thanks.

Offline

#4 2010-10-19 23:50:22

lilsirecho
Veteran
Registered: 2003-10-24
Posts: 5,000

Re: [SOLVED] Getting pacman to use a text file as input

Perhaps this procedure generated by karol will help:

 ls "kde" |grep 4.5.1 |xargs pacman -U 

It might need some modding but is the general idea.....


Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit!     X-ray confirms Iam spineless!

Offline

#5 2010-10-20 00:09:42

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: [SOLVED] Getting pacman to use a text file as input

If you still want to be able to pipe to pacman, I wrote a fairly non-invasive patch to do just that. I find it more unix'like, and xargs requires --no-confirm which is kinda icky.

Offline

#6 2010-10-20 00:55:05

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,672
Website

Re: [SOLVED] Getting pacman to use a text file as input

falconindy wrote:

If you still want to be able to pipe to pacman, I wrote a fairly non-invasive patch to do just that. I find it more unix'like, and xargs requires --no-confirm which is kinda icky.

I still have that patch flagged on my TODO list...  so it is not completely lost! tongue

Offline

#7 2010-10-20 01:12:09

DarksideEE7
Member
From: Arkansas, United States
Registered: 2009-06-06
Posts: 356

Re: [SOLVED] Getting pacman to use a text file as input

Well I'm not sure if I will be able to use the file in it's current format since I used:

sudo pacman -Q > laptop.pacman

to generate the file, so the version is after the package.

If anyone has any suggestions on how to remove the version column (using awk, sed, column, or something....) I would appreciate it.  I have very limited experience with awk and sed.

For instance, colunn -t | pacman.out results in output with it separated:

xvidcore                                     1.2.2-1
xz                                           4.999.9beta_174_g41bc-1
yajl                                         1.0.9-3
yaourt                                       0.9.4.3-1
yasm                                         1.0.1-1
zenity                                       2.32.0-1
zip                                          3.0-1
zlib                                         1.2.5-2
zvbi                                         0.2.33-2

If someone knows how to remove the last column then this would solve my problem:

sudo pacman -S $(< laptop.pacman)

EDIT:
This did it. 

cut -d ' ' -f 1 laptop.pacman

BTW if you want to install from the AUR this works for Clyde as well.  Thanks for the help everyone.

Last edited by DarksideEE7 (2010-10-20 01:39:27)

Offline

#8 2010-10-20 02:06:50

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: [SOLVED] Getting pacman to use a text file as input

As you discovered, you can use cut...

You can also use awk!

print '{ print $1 }' laptop.pacman

Or sed!

sed 's/ .*//' laptop.pacman

Or just bash!

while read package version; do echo $package; done < laptop.pacman

Or ed!

ed -s laptop.pacman <<< $',s/ .*//g\n,p'
Allan wrote:
falconindy wrote:

If you still want to be able to pipe to pacman, I wrote a fairly non-invasive patch to do just that. I find it more unix'like, and xargs requires --no-confirm which is kinda icky.

I still have that patch flagged on my TODO list...  so it is not completely lost! tongue

Oooh. I figured it was tossed out, since Dan and yourself didn't seem all that interested. /me waits patiently.

Offline

#9 2010-10-20 02:09:15

DarksideEE7
Member
From: Arkansas, United States
Registered: 2009-06-06
Posts: 356

Re: [SOLVED] Getting pacman to use a text file as input

Yea I need to use awk and sed more....they are very powerful tools.  My experience with them is limited to a basic tutorial.

Offline

Board footer

Powered by FluxBB