2020-09-21 08:18:39 +00:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
2021-08-04 19:44:04 +00:00
|
|
|
path_is=$(
|
|
|
|
LC_ALL=C update-alternatives --display "${__object_id?}" 2>/dev/null \
|
|
|
|
| awk '/link currently points to/ { print $5 }')
|
2020-09-21 08:18:39 +00:00
|
|
|
|
2021-08-02 19:25:08 +00:00
|
|
|
if [ -z "$path_is" ] && [ -z "${__cdist_dry_run+dry run}" ]
|
2020-09-21 08:18:39 +00:00
|
|
|
then
|
2021-08-02 19:25:08 +00:00
|
|
|
# NOTE: ignore error for dry-runs because a package providing the
|
|
|
|
# alternative might be managed by another cdist object (which
|
|
|
|
# wasn't executed, because dry run…).
|
2021-08-02 19:23:50 +00:00
|
|
|
echo "unable to get current path for ${__object_id:?}" >&2
|
2020-09-21 08:18:39 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "$path_is"
|