mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-11-23 02:42:17 +00:00
fix(go-xcat): read apt candidates in the C locale
check_repo_version_apt looks for the "Candidate:" label of apt-cache policy. A translated apt prints that label in the user's language. The package table of go-xcat check, install and update then showed every package as "(not found)" in the repositories. Run apt-cache policy with LC_ALL="C" inside check_repo_version_apt, so that every caller gets the untranslated labels. Drop the LC_ALL=C that the install filter added.
This commit is contained in:
@@ -952,7 +952,7 @@ function check_repo_version_apt()
|
||||
local ver=""
|
||||
local policy=""
|
||||
local rc=0
|
||||
policy="$(apt-cache policy "$@" 2>/dev/null)" || rc="$?"
|
||||
policy="$(LC_ALL="C" apt-cache policy "$@" 2>/dev/null)" || rc="$?"
|
||||
while read -r name ver
|
||||
do
|
||||
if [[ "${name}" =~ ^[a-z] ]]
|
||||
@@ -1994,7 +1994,7 @@ function install_packages_apt()
|
||||
[[ "$1" = "-y" ]] && yes=("-y") && shift
|
||||
local -a available=()
|
||||
local package="" ver="" versions=""
|
||||
versions="$(LC_ALL=C check_repo_version_apt "$@")"
|
||||
versions="$(check_repo_version_apt "$@")"
|
||||
warn_if_bad "$?" "query apt package candidates failed" || return 1
|
||||
# As with dnf --setopt=strict=0, a package the repositories lack must not stop the install.
|
||||
for package in "$@"
|
||||
|
||||
Reference in New Issue
Block a user