3

I'm trying to download driver of the AUR to install on a newly installed system (having no internet connection), however when I type

makepkg -s

It requires other packages to be installed. Being that this system has no internet I would like to download these packages (and all it's dependencies) from another PC having internet connection and later on install on the new system. I found a tutorial on the archlinux website about installing packages offline. Using

pacman -Sp <package_name> > /myPackages.list

Will create a list of all the packages that I specify in package_name. However I need all their dependencies too. So I want to know :

  1. Is there a simple way to do this ?
  2. Do I have to manually type in commands for every dependency package that is required ?
  3. Can a shell script be written to accomplish this ? If yes, how do I do that ?

1 Answer 1

3

Answer

There is a program called pactree which is installed along with the pacman package.
It's used to show the dependency tree for the specified package.

You can use it like this:

pactree -u <package_name>

However, unlike the pacman -Sp <package_name>, pactree only accepts one package name.

One solution

There are several ways to work around this issue, but judging by your question, I don't have a feeling that you are familiar with shell scripts (sorry if I'm mistaken) so I will explain one solution in details:

echo "package_name1 package_name2 ..." | xargs -n 1 pactree -u | sort -u | xargs -n 1 pacman -Sp > /myPackages.list

echo - Shell builtin command: Prints the argument to the stdout (with appended new line).

| - Pipe: Redirects the stdout from the left command to the stdin of the right command.

xargs - External command: Takes stdin and appends it to the argument list of given command.
-n 1 - xargs option: Execute the given command once for each argument from stdin.

pactree - External command: Show dependency tree for the given package.
-u - pactree option: Instead of a graph, print each dependency package in a separate line.

sort - External command: Sorts the text from the stdin and writes it to the stdout.
-u - sort option: Removes duplicates from sorted stdin.
(This is needed because some packages might have same dependencies.)

You are familiar with the rest of the line.

Note

pacman -Sp will report error if you give it the package from the AUR.

EDIT 17.09.2018

As pointed out by JdeBP, pactree is in now in the pacman-contrib package.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .