diff options
Diffstat (limited to 'libexec/container/info')
-rwxr-xr-x | libexec/container/info | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/libexec/container/info b/libexec/container/info index d030780..b713e7a 100755 --- a/libexec/container/info +++ b/libexec/container/info @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ # @@ -143,30 +143,34 @@ esac VERSION_BASH="$(chroot ${MACHINES}/${NAME} apt-cache policy bash | awk '/Installed: / { print $2 }')" case "${VERSION_BASH}" in - 4.1*) + 4.1-*|4.1.[0-9]*) OS="Debian 6 (squeeze)" ;; - 4.2*) + 4.2-*|4.2.[0-9]*) OS="Debian 7 (wheezy)" ;; - 4.3*) + 4.3-*|4.3.[0-9]*) OS="Debian 8 (jessie)" ;; - 4.4*) + 4.4-*|4.4.[0-9]*) OS="Debian 9 (stretch)" ;; - 5.0*) + 5.0-*|5.0.[0-9]*) OS="Debian 10 (buster)" ;; - 5.1*) + 5.1-*|5.1.[0-9]*) OS="Debian 11 (bullseye)" ;; + 5.2-*|5.2.[0-9]*) + OS="Debian 12 (bookworm)" + ;; + *) OS="n/a" ;; @@ -174,16 +178,16 @@ esac case "${STATUS}" in started) - IP="$(cnt run -n ${NAME} -- hostname -I | awk '{ print $1 }')" + IP="$(cnt run -n ${NAME} -- hostname -I)" ;; *) - if ls "${MACHINES}/${CONTAINER}/etc/systemd/network"/*.network > /dev/null 2>&1 + if ls "${MACHINES}/${NAME}/etc/systemd/network"/*.network > /dev/null 2>&1 then - IP="$(awk -FAddress= '/^Address/ { print $2 }' ${MACHINES}/${CONTAINER}/etc/systemd/network/*.network | head -n1)" - elif [ -e "${MACHINES}/${CONTAINER}/etc/network/interfaces" ] + IP="$(awk -FAddress= '/^Address/ { printf "%s ", $2 }' ${MACHINES}/${NAME}/etc/systemd/network/*.network)" + elif [ -e "${MACHINES}/${NAME}/etc/network/interfaces" ] then - IP="$(awk '/address/ { print $2 }' ${MACHINES}/${CONTAINER}/etc/network/interfaces | head -n1)" + IP="$(awk '/address/ { printf "%s ", $2 }' ${MACHINES}/${NAME}/etc/network/interfaces)" fi IP="${IP:-n/a}" |