1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-22 13:33:56 +03:00

man/check-os-release.*: allow ID_LIKE to have multiple values

I missed the fact that it is documented to be a space-separated list.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2021-05-22 20:29:03 +02:00
parent 82ca34e6e6
commit 91da09bd1a
2 changed files with 3 additions and 3 deletions

View File

@ -30,6 +30,6 @@ os_release = dict(read_os_release())
pretty_name = os_release.get('PRETTY_NAME', 'Linux')
print(f'Running on {pretty_name}')
if (os_release.get('ID', 'linux') == 'debian' or
os_release.get('ID_LIKE', None) == 'debian'):
if 'debian' in [os_release.get('ID', 'linux'),
*os_release.get('ID_LIKE', '').split()]:
print('Looks like Debian!')

View File

@ -5,6 +5,6 @@ test -e /etc/os-release && os_release='/etc/os-release' || os_release='/usr/lib/
echo "Running on ${PRETTY_NAME:-Linux}"
if [ "${ID:-linux}" = "debian" ] || [ "${ID_LIKE:-}" = "debian" ]; then
if [ "${ID:-linux}" = "debian" ] || [ "${ID_LIKE#*debian*}" != "${ID_LIKE}" ]; then
echo "Looks like Debian!"
fi