[type/__update_alternatives] Fix for non-English locales

Since update-alternatives(1) is localized, screen scraping its output breaks
if the locale is set to non-English.
This commit is contained in:
Dennis Camera 2021-08-04 21:44:04 +02:00
parent 0b3b47396f
commit bbcc81a984
2 changed files with 5 additions and 4 deletions

View file

@ -1,4 +1,4 @@
#!/bin/sh -e
update-alternatives --display "${__object_id:?}" 2>/dev/null \
| awk -F ' - ' '/priority [0-9]+$/ { print $1 }'
LC_ALL=C update-alternatives --display "${__object_id:?}" 2>/dev/null \
| awk -F ' - ' '/priority [0-9]+$/ { print $1 }'

View file

@ -1,7 +1,8 @@
#!/bin/sh -e
path_is="$( update-alternatives --display "${__object_id:?}" 2>/dev/null \
| awk '/link currently points to/ {print $5}' )"
path_is=$(
LC_ALL=C update-alternatives --display "${__object_id?}" 2>/dev/null \
| awk '/link currently points to/ { print $5 }')
if [ -z "$path_is" ] && [ -z "${__cdist_dry_run+dry run}" ]
then