You are not logged in.

#1 2014-09-28 15:46:30

aaditya
Member
Registered: 2013-09-01
Posts: 174

[Solved] How to download pacman database files from a remote server

Hi,

I would like to download a copy of the pacman sync database files from a remote Archlinux server, and store them into a specified location.

After that the stored copy of database will be queried using package-query to check what version of specified package is available.

Can I do this from pacman, a pacman related utility, or any other program?

Thanks in advance.

Last edited by aaditya (2014-09-28 17:21:10)

Offline

#2 2014-09-28 15:58:30

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: [Solved] How to download pacman database files from a remote server

Have a look at the pacman man page, in particular the -b/--dbpath and -r/--root options.

Last edited by tomk (2014-09-28 15:58:57)

Offline

#3 2014-09-28 16:15:39

aaditya
Member
Registered: 2013-09-01
Posts: 174

Re: [Solved] How to download pacman database files from a remote server

tomk wrote:

Have a look at the pacman man page, in particular the -b/--dbpath and -r/--root options.

Thanks, that answers half of my question.
Now I can download the pacman database to the current directory using

sudo pacman -b . -Sy

Is there any way I can specify the mirror for pacman to download the sync database files from?

Last edited by aaditya (2014-09-28 17:26:15)

Offline

#4 2014-09-28 16:32:40

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: [Solved] How to download pacman database files from a remote server

/etc/pacman.conf or /etc/pacman.d/mirrorlist .

Offline

#5 2014-09-28 17:20:52

aaditya
Member
Registered: 2013-09-01
Posts: 174

Re: [Solved] How to download pacman database files from a remote server

tomk wrote:

/etc/pacman.conf or /etc/pacman.d/mirrorlist .

Thanks, I guess that answers the second part as well.

Now I am using the command

sudo pacman --config ./pacman-i686.conf -b . -Sy

and the contents of pacman-i686.conf is

#
# pacman.conf
#
# See the pacman.conf(5) manpage for option and repository directives

#
# GENERAL OPTIONS
#
[options]
Architecture = auto
DBPath = .

#
# REPOSITORIES
#   - can be defined here or included from another file
#   - pacman will search repositories in the order defined here
#   - local/custom mirrors can be added here or in separate files
#   - repositories listed first will take precedence when packages
#     have identical names, regardless of version number
#   - URLs will have $repo replaced by the name of the current repo
#   - URLs will have $arch replaced by the name of the architecture
#
# Repository entries are of the format:
#       [repo-name]
#       Server = ServerName
#       Include = IncludePath
#
# The header [repo-name] is crucial - it must be present and
# uncommented to enable the repo.
#

[core]
SigLevel = PackageRequired
Server = ftp://ftp.archlinux.org/$repo/os/$arch

[extra]
SigLevel = PackageRequired
Server = ftp://ftp.archlinux.org/$repo/os/$arch

[community]
SigLevel = PackageRequired
Server = ftp://ftp.archlinux.org/$repo/os/$arch

and for querying I can use

pacman --config ./pacman-i686.conf -Ss mousepad

Marking as solved.

Offline

#6 2014-09-28 17:52:24

bstaletic
Member
Registered: 2014-02-02
Posts: 658

Re: [Solved] How to download pacman database files from a remote server

Why don't you make functions in you shell's rc so you need not type such long commands.

Offline

#7 2014-09-28 17:58:24

aaditya
Member
Registered: 2013-09-01
Posts: 174

Re: [Solved] How to download pacman database files from a remote server

Slightly related:

If I am downloading the database files to my current folder (owned by my user), can I run pacman as non-root?
At present I have to use sudo pacman --config ./pacman-i686.conf -b . -Sy

Offline

#8 2014-09-28 18:26:53

progandy
Member
Registered: 2012-05-17
Posts: 5,317

Re: [Solved] How to download pacman database files from a remote server

aaditya wrote:

Slightly related:

If I am downloading the database files to my current folder (owned by my user), can I run pacman as non-root?
At present I have to use sudo pacman --config ./pacman-i686.conf -b . -Sy

I'd suggest you convert the download logic into a script without pacman. You need a mirror, the path to the database file, and curl. For querying I'd think about using expac and patching it to accept a different configuration file.


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#9 2014-09-28 19:24:58

aaditya
Member
Registered: 2013-09-01
Posts: 174

Re: [Solved] How to download pacman database files from a remote server

progandy wrote:
aaditya wrote:

Slightly related:

If I am downloading the database files to my current folder (owned by my user), can I run pacman as non-root?
At present I have to use sudo pacman --config ./pacman-i686.conf -b . -Sy

I'd suggest you convert the download logic into a script without pacman. You need a mirror, the path to the database file, and curl. For querying I'd think about using expac and patching it to accept a different configuration file.

Maybe some other time..
At the moment just looking for something to get the job done.

Offline

#10 2014-09-28 19:35:47

progandy
Member
Registered: 2012-05-17
Posts: 5,317

Re: [Solved] How to download pacman database files from a remote server

The example implementation pycman from pyalpm works without root if the database is writable:

pycman-sync -yb /tmp/testdb
pycman-sync -sb /tmp/testdb package_name

Last edited by progandy (2014-09-28 19:36:04)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#11 2014-09-28 19:41:34

aaditya
Member
Registered: 2013-09-01
Posts: 174

Re: [Solved] How to download pacman database files from a remote server

progandy wrote:

The example implementation pycman from pyalpm works without root if the database is writable:

pycman-sync -yb /tmp/testdb
pycman-sync -sb /tmp/testdb package_name

Thanks, will give it a go tomorrow.

Offline

Board footer

Powered by FluxBB