0

TLDR:

XferCommand = echo Downloading %u ... && /usr/bin/aria2c --conf-path=/etc/pacman-aria2.conf %u

pacman.conf の出力

Downloading https://mirror.23media.com/manjaro/stable/core/x86_64/core.db ... && /usr/bin/aria2c --conf-path=/etc/pacman-aria2.conf https://mirror.23media.com/manjaro/stable/core/x86_64/core.db

そして 2 番目の aria2 コマンドは決して実行されません - pacman.conf と pacman-aria2.conf は一番下にあり、長いバージョンは TLDR の下にあります

はじめに: 私が達成しようとしているのは、pacman で外部ダウンローダーを使用して、ターミナル出力に不要な情報を入力することなく、現在ダウンロードしているものを示すことです。pacman の奇妙なダウンロード速度の問題のため、私は wiki が推奨するものを使用しようとしました: /etc/pacman.conf で XferCommand を使用して、aria2 をダウンローダーとして使用します。この wiki ( https://bbs.archlinux.org/viewtopic.php?id=192072 ) の記事にリンクされているので、/etc/pacman.conf で次のコマンドを使用して aria2 を使用しました。 XferCommand = echo Downloading %u ... && /usr/bin/aria2c --conf-path=/etc/pacman-aria2.conf %u

下部に完全な pacman.conf と pacman-aria2.conf があります。端末で実行すると (そして %u を別のものに変更すると)、このコマンドは機能します。悲しいことに、pacman.conf で実行すると、echo は "&&" などを含む行全体を出力するだけです。の完全な出力pacman -Syy

Downloading https://mirror.23media.com/manjaro/stable/extra/x86_64/extra.db ... && /usr/bin/aria2c --conf-path=/etc/pacman-aria2.conf https://mirror.23media.com/manjaro/stable/extra/x86_64/extra.db
Downloading https://mirror.23media.com/manjaro/stable/community/x86_64/community.db ... && /usr/bin/aria2c --conf-path=/etc/pacman-aria2.conf https://mirror.23media.com/manjaro/stable/community/x86_64/community.db
Downloading https://mirror.23media.com/manjaro/stable/multilib/x86_64/multilib.db ... && /usr/bin/aria2c --conf-path=/etc/pacman-aria2.conf https://mirror.23media.com/manjaro/stable/multilib/x86_64/multilib.db

完全な出力sudo pacman -S 0ad(多くの依存関係と大きなファイル サイズを持つ pacman の最初のエントリ):

resolving dependencies...
looking for conflicting packages...

Packages (6) 0ad-data-a23.1-1  enet-1.3.14-1  gloox-1.0.22-1  miniupnpc-2.1.20190408-1  wxgtk2-3.0.4-2  0ad-a23.1-7

Total Download Size:      8,95 MiB
Total Installed Size:  2055,95 MiB

:: Proceed with installation? [Y/n] 
:: Retrieving packages...
Downloading https://mirror.23media.com/manjaro/stable/community/x86_64/gloox-1.0.22-1-x86_64.pkg.tar.xz ... && /usr/bin/aria2c --conf-path=/etc/pacman-aria2.conf https://mirror.23media.com/manjaro/stable/community/x86_64/gloox-1.0.22-1-x86_64.pkg.tar.xz
Downloading https://mirror.23media.com/manjaro/stable/community/x86_64/miniupnpc-2.1.20190408-1-x86_64.pkg.tar.xz ... && /usr/bin/aria2c --conf-path=/etc/pacman-aria2.conf https://mirror.23media.com/manjaro/stable/community/x86_64/miniupnpc-2.1.20190408-1-x86_64.pkg.tar.xz
Downloading https://mirror.23media.com/manjaro/stable/community/x86_64/0ad-a23.1-7-x86_64.pkg.tar.xz ... && /usr/bin/aria2c --conf-path=/etc/pacman-aria2.conf https://mirror.23media.com/manjaro/stable/community/x86_64/0ad-a23.1-7-x86_64.pkg.tar.xz
(6/6) checking keys in keyring                                                            [####################################################] 100%
^C/6) checking package integrity                                                          [----------------------------------------------------]   0%
Interrupt signal received

整合性テストが進まなかったため中断しましたが、何もダウンロードされていないことがわかりました。時間はまったくかからず、プログラムには少なくとも 1GB が必要だったからです。

もちろん、最初にエコーを完全に除去しました。これは機能します。しかし、「ダウンロード結果」(ファイルのダウンロードが完了すると aria2 によって自動的に出力される) が端末に大量のスパムを送信し、何も読み取れなかったので、この出力を削除する行を pacman-aria2.conf に追加しました。しかし、出力に書き込まれる内容はすべて次のようになります。 [#b72206 3.9MiB/5.2MiB(75%) CN:3 DL:5.0MiB] つまり、実際にダウンロードしているものがわからないため、特に pacman が一度に多くのものをダウンロードしている場合 (例: pacman -Syu)、「echo %u」が必要になります。

その他の修正の試み: 私の pacman.conf で、(バグ) 修正を試みたものの残りを見ることができます。ここに短いリストがあります:

生成される 2 つのコマンドの順序の変更Exception caught Exception: [download_helper.cc:451] errorCode=1 Unrecognized URI or unsupported protocol: &&

2 つの別々の行に 2 つのコマンドを含む小さな bash スクリプト (/usr/local/bin/pacman-aria2.sh) を作成すると、次のようになりました。

Exception caught
Exception: [download_helper.cc:451] errorCode=1 Unrecognized URI or unsupported protocol: %u 

これは、変数をスクリプトに送信していないことが原因だと思いますが、それを適切に行う方法がわかりません

wget も curl も wiki の元のコマンドも、必要な出力を生成しません。wget は再びコンソールと wiki コマンドをスパムしますが、curl にはまったく情報がありません。

結論: wiki にも pacman の man ページにも XferCommand に関する詳しい情報が記載されていないため、私は推測できません。どんなヒントでも大歓迎です。さらに情報が必要な場合は、提供しようとします。

おそらく関連情報:

uname -srv: Linux 5.4.2-1-MANJARO #1 SMP PREEMPT Thu Dec 5 09:55:57 UTC 2019
pacman -V: Pacman v5.2.1 - libalpm v12.0.1
architecture: x86_64

ファイル:

/etc/pacman.conf:

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

#
# GENERAL OPTIONS
#
[options]
# The following paths are commented out with their default values listed.
# If you wish to use different paths, uncomment and update the paths.
#RootDir     = /
#DBPath      = /var/lib/pacman/
CacheDir = /var/cache/pacman/pkg/
#LogFile     = /var/log/pacman.log
#GPGDir      = /etc/pacman.d/gnupg/
#HookDir     = /etc/pacman.d/hooks/
HoldPkg      = pacman glibc manjaro-system
# If upgrades are available for these packages they will be asked for first
SyncFirst    = manjaro-system archlinux-keyring manjaro-keyring
#XferCommand = /usr/bin/curl -C - -f %u > %o
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
XferCommand = /usr/bin/aria2c --conf-path=/etc/pacman-aria2.conf %u
#XferCommand = /usr/bin/aria2c --allow-overwrite=true --continue=true --file-allocation=none --log-level=error --max-tries=2 --max-connection-per-server=2 --max-file-not-found=5 --min-split-size=5M --no-conf --remote-time=true --summary-interval=60 --timeout=5 --dir=/ --out %o %u
#XferCommand = /usr/bin/aria2c --conf-path=/etc/pacman-aria2.conf %u && echo Downloading %u ...
#XferCommand = echo Downloading %u ... && /usr/bin/aria2c --conf-path=/etc/pacman-aria2.conf %u
#XferCommand = /usr/local/bin/pacman-aria2.sh
#CleanMethod = KeepInstalled
#UseDelta    = 0.7
Architecture = auto

# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
#IgnorePkg   =
#IgnoreGroup =

#NoUpgrade   =
#NoExtract   =

# Misc options
#UseSyslog
Color
#TotalDownload
# We cannot check disk space from within a chroot environment
CheckSpace
#VerbosePkgLists

# By default, pacman accepts packages signed by keys that its local keyring
# trusts (see pacman-key and its man page), as well as unsigned packages.
SigLevel    = Required DatabaseOptional
LocalFileSigLevel = Optional
#RemoteFileSigLevel = Required

# NOTE: You must run `pacman-key --init` before first using pacman; the local
# keyring can then be populated with the keys of all official Manjaro Linux
# packagers with `pacman-key --populate archlinux manjaro`.

#
# 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.
#

# The testing repositories are disabled by default. To enable, uncomment the
# repo name header and Include lines. You can add preferred servers immediately
# after the header, and they will be used before the default mirrors.

[core]
SigLevel = PackageRequired DatabaseNever
Include = /etc/pacman.d/mirrorlist

[extra]
SigLevel = PackageRequired DatabaseNever
Include = /etc/pacman.d/mirrorlist

[community]
SigLevel = PackageRequired DatabaseNever
Include = /etc/pacman.d/mirrorlist

# If you want to run 32 bit applications on your x86_64 system,
# enable the multilib repositories as required here.

[multilib]
SigLevel = PackageRequired DatabaseNever
Include = /etc/pacman.d/mirrorlist

# An example of a custom package repository.  See the pacman manpage for
# tips on creating your own repositories.
#[custom]
#SigLevel = Optional TrustAll
#Server = file:///home/custompkgs

/etc/pacman-aria2.conf:

timeout=60
connect-timeout=30
max-tries=5
retry-wait=10
max-file-not-found=1

# downloading
split=3
max-connection-per-server=3
min-split-size=1M
max-concurrent-downloads=1
file-allocation=none
remote-time=true
conditional-get=true
no-netrc=true

# resuming
continue=true
allow-overwrite=true
always-resume=false

# proxy
#http-proxy=127.0.0.1:8080
#https-proxy=127.0.0.1:8080
#ftp-proxy=127.0.0.1:8080

# console
#quiet=true
download-result=hide
console-log-level=warn
summary-interval=0
#enable-color=false
#human-readable=false
#show-console-readout=false
#truncate-console-readout=false

# logging
log-level=warn
log=/var/log/pacman-aria2.log
4

1 に答える 1