You are not logged in.
Hi all!
I'd like to know if there is a way to export a package-list without the version of every package to be able to export the installed packages, edit the exported file and after that have a list which I can use to setup another computer with the same packages.
pacman -Q
just gives me the packages with version info and I need the package names separated by only one space.
Or is there another solution to export and then install the packages in a text-file?
For example:
Computer A: -> generate package-list
Computer B: -> import/read package-list from Computer A and tell pacman to install all those packages as well.
Thanks in advance for your help!
Micha
Offline
pacman -Q|cut -f 1 -d " "
gets you the list of installed packages, with the version bit cut off
Offline
All you need is simple shell manipulations. Any of these will give you what you want:
$ pacman -Q | cut -d' ' -f1
$ pacman -Q | awk '{ print $1 }'
$ pacman -Q | sed 's/ .*//'
-edit- Seems I took too long to finish my reply, and was beaten to the punch
Last edited by Cerebral (2007-12-03 15:44:11)
Offline
Thanks guys! That's already a lot.
But do you know how I could "import" the list or install a new system from a "package.list" containing the package-names generated by one of the commands above?
Offline
Again, fairly straightforward shell scripting works in your favour. Assuming you have a list of packages named package.list, you could just use $(cat package.list) to get it. Example:
$ cat package.list
apache
aspell
aspell-eng
pidgin
gtk
$ sudo pacman -S $(cat package.list)
Last edited by Cerebral (2007-12-03 17:00:47)
Offline
Ahhh, thanks again!
I should get into the shell a bit deeper soon
And to give something as well, here's the detailed reason I was asking. I put a little script into the ~/.kde/Autostart folder that creates that list of packages after each boot so when something "happenes" to the system (I know, it's not likely , I have a fairly recent package-list.
The script now looks like this:
sudo pacman -Q|cut -f 1 -d " " > packages.`date +%y%m%d%H%M`
and that list I will gladly "import" with your last command!
I don't know if this is useful for anyone else but me, but... anyhow
Thanks again!
Last edited by Micha (2007-12-05 17:43:06)
Offline
You don't need sudo for pacman -Q, you can run it as a regular user.
Offline
See also http://bugs.archlinux.org/task/8470
parsing the -Q output with cut is trivial, but maybe some users will prefer this way in 3.1 :
> pacman -Qh |grep quiet
-q --quiet show less information for query and search
> pacman -Qq | head -n 2
a52dec
aalib
pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))
Offline